Skip to contentSkip to conversation

staging: rtl8723bs: change sscanf to kstrtoint

PATCH New Harshavardhan Unnibhavi 2 participants 2 messages Jun 22, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: change sscanf to kstrtoint

Fixes following checkpath.pl warning:
Prefer kstrto<type> to single variable sscanf

Signed-off-by Harshavardhan Unnibhavi <hvubfoss at gmail.com>
---
 drivers/staging/rtl8723bs/os_dep/rtw_proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/os_dep/rtw_proc.c +1 -1
index 5f950fda48ea..b700363c899c 100644
@@ -468,7 +468,7 @@ ssize_t proc_set_odm_dbg_comp(struct file *file, const char __user *buffer, size
 
 	if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
 
-		int num = sscanf(tmp, "%llx", &dbg_comp);
+		int num = kstrtoint(tmp, "%llx", &dbg_comp);
 
 		if (num != 1)
 			return count;
Signature · 1 line
2.17.1
maintainer
#1 lore raw

PATCH 1/1 staging: rtl8723bs: change sscanf to kstrtoint

Quoted 13 lines · Harshavardhan Unnibhavi

Fixes following checkpath.pl warning:
Prefer kstrto<type> to single variable sscanf

Signed-off-by Harshavardhan Unnibhavi <hvubfoss at gmail.com>
---
 drivers/staging/rtl8723bs/os_dep/rtw_proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/os_dep/rtw_proc.c +0 -0
index 5f950fda48ea..b700363c899c 100644

drivers/staging/rtl8723bs/os_dep/rtw_proc.c ssize_t proc_set_odm_dbg_comp(struct file *file, const char __user *buffer, size · line 471

Quoted 5 lines
drivers/staging/rtl8723bs/os_dep/rtw_proc.c +1 -1
@@ -468,7 +468,7 @@ ssize_t proc_set_odm_dbg_comp(struct file *file, const char __user *buffer, size
 
 	if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
 
-		int num = sscanf(tmp, "%llx", &dbg_comp);
+		int num = kstrtoint(tmp, "%llx", &dbg_comp);

If the conversion was this easy, we would have done it with a global search/replace a long time ago :)

Are you _sure_ this is correct?

thanks,

greg k-h