All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH 1/4] staging: lustre: Use kstrtol instead of sscanf.
Date: Sun, 1 Mar 2015 16:49:12 -0800	[thread overview]
Message-ID: <20150302004912.GA12719@kroah.com> (raw)
In-Reply-To: <053f80bb1c0f723a2a9586070e6fbe48ff9511fb.1425200447.git.navyasri.tech@gmail.com>

On Sun, Mar 01, 2015 at 02:37:26PM +0530, Navya Sri Nizamkari wrote:
> Parsing error in sscanf returns a zero, while kstrtol returns
> non-zero.This patch changes sscanf into kstrtol by making
> appropriate changes in the case of parsing error conditional
> check to fix the following checkpatch.pl warning:
> 
> WARNING: Prefer kstrto<type> to single variable sscanf
> 
> Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
> ---
>  drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
> index 26e8626..44d41dd 100644
> --- a/drivers/staging/lustre/lustre/llite/llite_lib.c
> +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
> @@ -2150,7 +2150,7 @@ 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)
> +	if (kstrtol(ptr, 0, &x))
>  		return -EINVAL;
>  	sb = (void *)x;
>  	/* This better be a real Lustre superblock! */
> -- 
> 1.9.1

This doesn't apply to my tree :(


  reply	other threads:[~2015-03-02  0:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-01  9:06 [PATCH 0/4] staging: lustre: Fix warnings in llite_lib.c Navya Sri Nizamkari
2015-03-01  9:07 ` [PATCH 1/4] staging: lustre: Use kstrtol instead of sscanf Navya Sri Nizamkari
2015-03-02  0:49   ` Greg KH [this message]
2015-03-01  9:08 ` [PATCH 2/4] staging: lustre: Remove unnecessary braces Navya Sri Nizamkari
2015-03-02  0:50   ` [Outreachy kernel] " Greg KH
2015-03-01  9:08 ` [PATCH 3/4] staging: lustre: Remove whitespace Navya Sri Nizamkari
2015-03-02  0:50   ` [Outreachy kernel] " Greg KH
2015-03-01  9:09 ` [PATCH 4/4] staging: lustre: Remove space in function call Navya Sri Nizamkari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150302004912.GA12719@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=navyasri.tech@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.