All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jad Keskes <inasj268@gmail.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: misc: cytherm: replace deprecated simple_strtoul with kstrtoint
Date: Wed, 8 Jul 2026 17:12:34 +0200	[thread overview]
Message-ID: <2026070803-capable-economic-d54c@gregkh> (raw)
In-Reply-To: <20260622123124.2380612-1-inasj268@gmail.com>

On Mon, Jun 22, 2026 at 01:31:24PM +0100, Jad Keskes wrote:
> simple_strtoul() is deprecated in favor of kstrtoint(). The old
> function silently accepts garbage input. kstrtoint() returns -EINVAL
> so the driver can actually tell the user they typed something stupid
> instead of accepting 0 and wondering why the thermometer isn't
> responding.
> 
> The 0-255 clamping stays the same, just with proper error handling
> in front of it now.
> 
> Signed-off-by: Jad Keskes <inasj268@gmail.com>
> ---
>  drivers/usb/misc/cytherm.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
> index b183df9826bc..81de3fecf3da 100644
> --- a/drivers/usb/misc/cytherm.c
> +++ b/drivers/usb/misc/cytherm.c
> @@ -85,7 +85,9 @@ static ssize_t brightness_store(struct device *dev, struct device_attribute *att
>  	if (!buffer)
>  		return 0;
>  
> -	cytherm->brightness = simple_strtoul(buf, NULL, 10);
> +	retval = kstrtoint(buf, 10, &cytherm->brightness);
> +	if (retval < 0)
> +		return retval;

This changes the user/kernel functionality, are you sure it is safe to
do so?

What is wrong with leaving the current calls?

thanks,

greg k-h

  reply	other threads:[~2026-07-08 15:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 12:31 [PATCH] usb: misc: cytherm: replace deprecated simple_strtoul with kstrtoint Jad Keskes
2026-07-08 15:12 ` Greg KH [this message]
2026-07-08 15:20   ` Jad Keskes
2026-07-10 13:11     ` Greg KH

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=2026070803-capable-economic-d54c@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=inasj268@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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 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.