Thread (8 messages) flat view 8 messages, 1 author, 2014-07-12
STALE4422d

[PATCH 1/7] powerpc: fadump: replace sscanf by kstrtoint

From: Fabian Frederick <hidden>
Date: 2014-07-12 11:36:34
Also in: lkml
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Linus Torvalds

See checkpatch warning
"Prefer kstrto<type> to single variable sscanf"

Signed-off-by: Fabian Frederick <redacted>
---
 arch/powerpc/kernel/fadump.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 742694c..3c40b5f 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -426,6 +426,7 @@ static inline int fadump_gpr_index(u64 id)
 {
 	int i = -1;
 	char str[3];
+	int rc;
 
 	if ((id & GPR_MASK) == REG_ID("GPR")) {
 		/* get the digits at the end */
@@ -434,8 +435,8 @@ static inline int fadump_gpr_index(u64 id)
 		str[2] = '\0';
 		str[1] = id & 0xff;
 		str[0] = (id >> 8) & 0xff;
-		sscanf(str, "%d", &i);
-		if (i > 31)
+		rc = kstrtoint(str, 0, &i);
+		if (rc || i > 31)
 			i = -1;
 	}
 	return i;
-- 
1.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help