From: Jani Nikula <jani.nikula@linux.intel.com>
To: Cong Liu <liucong2@kylinos.cn>, Daniel Vetter <daniel@ffwll.ch>,
Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org, Cong Liu <liucong2@kylinos.cn>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] fbdev/core: Replace deprecated simple_strtol with kstrtol
Date: Thu, 01 Feb 2024 12:03:53 +0200 [thread overview]
Message-ID: <87cytgh56e.fsf@intel.com> (raw)
In-Reply-To: <20240201070216.3291999-1-liucong2@kylinos.cn>
On Thu, 01 Feb 2024, Cong Liu <liucong2@kylinos.cn> wrote:
> This patch replaces the use of the deprecated simple_strtol [1] function
> in the modedb.c file with the recommended kstrtol function. This change
> improves error handling and boundary checks.
>
> [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull
>
> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
This is completely wrong, and obviously not tested at all.
The recommended replacements are *not* drop-in replacements. Look into
the documentation of the functions.
BR,
Jani.
> ---
> drivers/video/fbdev/core/modedb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c
> index 7196b055f2bd..eebbbc7e2aa3 100644
> --- a/drivers/video/fbdev/core/modedb.c
> +++ b/drivers/video/fbdev/core/modedb.c
> @@ -661,7 +661,7 @@ int fb_find_mode(struct fb_var_screeninfo *var,
> namelen = i;
> if (!refresh_specified && !bpp_specified &&
> !yres_specified) {
> - refresh = simple_strtol(&name[i+1], NULL,
> + refresh = kstrtol(&name[i+1], NULL,
> 10);
> refresh_specified = 1;
> if (cvt || rb)
> @@ -672,7 +672,7 @@ int fb_find_mode(struct fb_var_screeninfo *var,
> case '-':
> namelen = i;
> if (!bpp_specified && !yres_specified) {
> - bpp = simple_strtol(&name[i+1], NULL,
> + bpp = kstrtol(&name[i+1], NULL,
> 10);
> bpp_specified = 1;
> if (cvt || rb)
> @@ -682,7 +682,7 @@ int fb_find_mode(struct fb_var_screeninfo *var,
> break;
> case 'x':
> if (!yres_specified) {
> - yres = simple_strtol(&name[i+1], NULL,
> + yres = kstrtol(&name[i+1], NULL,
> 10);
> yres_specified = 1;
> } else
> @@ -719,7 +719,7 @@ int fb_find_mode(struct fb_var_screeninfo *var,
> }
> }
> if (i < 0 && yres_specified) {
> - xres = simple_strtol(name, NULL, 10);
> + xres = kstrtol(name, NULL, 10);
> res_specified = 1;
> }
> done:
--
Jani Nikula, Intel
prev parent reply other threads:[~2024-02-01 10:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 7:02 [PATCH] fbdev/core: Replace deprecated simple_strtol with kstrtol Cong Liu
2024-02-01 7:02 ` Cong Liu
2024-02-01 10:03 ` Jani Nikula [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=87cytgh56e.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=daniel@ffwll.ch \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liucong2@kylinos.cn \
/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.