* [PATCH v2 2/3] Staging: lustre: use kstrtoul() instead of sscanf()
@ 2015-02-21 20:47 aybuke ozdemir
2015-02-21 20:55 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: aybuke ozdemir @ 2015-02-21 20:47 UTC (permalink / raw)
To: outreachy-kernel; +Cc: aybuke ozdemir
This patch makes checkpatch.pl by fixing the following warning:
WARNING: Prefer kstrto<type> to single variable sscanf.
I used to kstrtoul can convert unsigned long instead of sscanf
Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
---
Changes since v1:
* Removed unnecessary variable rc1.
* The return value is changed(Returns 0 on success).
* Changed the description
---
drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index a3367bf..fb99cdb 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -2198,7 +2198,8 @@ int ll_process_config(struct lustre_cfg *lcfg)
ptr = strrchr(lustre_cfg_string(lcfg, 0), '-');
if (!ptr || !*(++ptr))
return -EINVAL;
- if (sscanf(ptr, "%lx", &x) != 1)
+ rc = kstrtoul(ptr, 16, &x);
+ if (rc != 0)
return -EINVAL;
sb = (void *)x;
/* This better be a real Lustre superblock! */
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH v2 2/3] Staging: lustre: use kstrtoul() instead of sscanf()
2015-02-21 20:47 [PATCH v2 2/3] Staging: lustre: use kstrtoul() instead of sscanf() aybuke ozdemir
@ 2015-02-21 20:55 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2015-02-21 20:55 UTC (permalink / raw)
To: aybuke ozdemir; +Cc: outreachy-kernel
On Sat, 21 Feb 2015, aybuke ozdemir wrote:
> This patch makes checkpatch.pl by fixing the following warning:
> WARNING: Prefer kstrto<type> to single variable sscanf.
> I used to kstrtoul can convert unsigned long instead of sscanf
This looks better.
This patch is part of a series, so you have to send the whole series
again as v2. For the others just put a comment below the --- saying that
they have not changed.
julia
> Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
> ---
> Changes since v1:
> * Removed unnecessary variable rc1.
> * The return value is changed(Returns 0 on success).
> * Changed the description
> ---
> drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
> index a3367bf..fb99cdb 100644
> --- a/drivers/staging/lustre/lustre/llite/llite_lib.c
> +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
> @@ -2198,7 +2198,8 @@ int ll_process_config(struct lustre_cfg *lcfg)
> ptr = strrchr(lustre_cfg_string(lcfg, 0), '-');
> if (!ptr || !*(++ptr))
> return -EINVAL;
> - if (sscanf(ptr, "%lx", &x) != 1)
> + rc = kstrtoul(ptr, 16, &x);
> + if (rc != 0)
> return -EINVAL;
> sb = (void *)x;
> /* This better be a real Lustre superblock! */
> --
> 1.9.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1424551663-14662-1-git-send-email-aybuke.147%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-21 20:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-21 20:47 [PATCH v2 2/3] Staging: lustre: use kstrtoul() instead of sscanf() aybuke ozdemir
2015-02-21 20:55 ` [Outreachy kernel] " Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.