Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: tidspbridge: replace strict_strtol() with kstrtos32()

The usage of strict_strtol() is not preferred, because
strict_strtol() is obsolete. Thus, kstrtos32() should be
used in order to convert a string to s32. Also, error handling
is added to get rid of a __must_check warning.

This fixes a memory corruption bug as well.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jingoo Han and committed by
Greg Kroah-Hartman
932ef368 72bb99cf

+5 -2
+5 -2
drivers/staging/tidspbridge/pmgr/dbll.c
··· 1120 1120 or DYN_EXTERNAL, then mem granularity information is present 1121 1121 within the section name - only process if there are at least three 1122 1122 tokens within the section name (just a minor optimization) */ 1123 - if (count >= 3) 1124 - strict_strtol(sz_last_token, 10, (long *)&req); 1123 + if (count >= 3) { 1124 + status = kstrtos32(sz_last_token, 10, &req); 1125 + if (status) 1126 + goto func_cont; 1127 + } 1125 1128 1126 1129 if ((req == 0) || (req == 1)) { 1127 1130 if (strcmp(sz_sec_last_token, "DYN_DARAM") == 0) {