public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Riyan Dhiman <riyandhiman14@gmail.com>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: core: convert simple_stroul to kstroul
Date: Mon, 16 Sep 2024 18:19:17 +0300	[thread overview]
Message-ID: <ZuhMdXFhhVUXh8Il@black.fi.intel.com> (raw)
In-Reply-To: <CAPDyKFqdu07MwGyoJ8oMmpFw2u2=1zc8m6LCais8Wva58uTcug@mail.gmail.com>

On Tue, Sep 03, 2024 at 02:37:25PM +0200, Ulf Hansson wrote:
> On Sun, 1 Sept 2024 at 20:22, Riyan Dhiman <riyandhiman14@gmail.com> wrote:
> >
> > simple_strtoul() is obsolete and lacks proper error handling, making it
> > unsafe for converting strings to unsigned long values. Replace it with
> > kstrtoul(), which provides robust error checking and better safety.
> >
> > This change improves the reliability of the string-to-integer conversion
> > and aligns with current kernel coding standards. Error handling is added
> > to catch conversion failures, returning -EINVAL when input is invalid.
> >
> > Issue reported by checkpatch:
> > - WARNING: simple_strtoul is obsolete, use kstrtoul instead

In rare cases this is a false positive, here seems to be okay.

...

> > +       if (kstrtoul(buf, 0, &set)) {
> >                 ret = -EINVAL;
> >                 goto out;
> >         }

Now you shadow the error code of kstrtox(), this has to be as simple as

       ret = kstrtoul(buf, 0, &set);
       if (ret)
               goto out;

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2024-09-16 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-01 18:22 [PATCH] mmc: core: convert simple_stroul to kstroul Riyan Dhiman
2024-09-03 12:37 ` Ulf Hansson
2024-09-16 15:19   ` Andy Shevchenko [this message]

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=ZuhMdXFhhVUXh8Il@black.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=riyandhiman14@gmail.com \
    --cc=ulf.hansson@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox