mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Daniel Yang <danielyangkang@gmail.com>, akpm <akpm@linux-foundation.org>
Cc: "open list:ORACLE CLUSTER FILESYSTEM 2 (OCFS2)"
	<ocfs2-devel@lists.linux.dev>,
	open list <linux-kernel@vger.kernel.org>,
	Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>
Subject: Re: [PATCH v2] ocfs2: replace deprecated simple_strtol with kstrtol
Date: Sun, 17 Nov 2024 20:30:29 +0800	[thread overview]
Message-ID: <6a9c30d7-dce1-4323-bd48-0bef8084d5ea@linux.alibaba.com> (raw)
In-Reply-To: <20241115080018.5372-1-danielyangkang@gmail.com>



On 11/15/24 4:00 PM, Daniel Yang wrote:
> The function simple_strtol ignores overflows and has an awkward
> interface for error checking. Replace with the recommended kstrtol
> function leads to clearer error checking and safer conversions.
> 
> Signed-off-by: Daniel Yang <danielyangkang@gmail.com>

Looks good.
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>

> ---
> v1->v2: reuse ret and remove blank line
> 
>  fs/ocfs2/cluster/heartbeat.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
> index 4b9f45d70..18333aa19 100644
> --- a/fs/ocfs2/cluster/heartbeat.c
> +++ b/fs/ocfs2/cluster/heartbeat.c
> @@ -3,6 +3,7 @@
>   * Copyright (C) 2004, 2005 Oracle.  All rights reserved.
>   */
>  
> +#include "linux/kstrtox.h"
>  #include <linux/kernel.h>
>  #include <linux/sched.h>
>  #include <linux/jiffies.h>
> @@ -1777,8 +1778,8 @@ static ssize_t o2hb_region_dev_store(struct config_item *item,
>  	if (o2nm_this_node() == O2NM_MAX_NODES)
>  		goto out;
>  
> -	fd = simple_strtol(p, &p, 0);
> -	if (!p || (*p && (*p != '\n')))
> +	ret = kstrtol(p, 0, &fd);
> +	if (ret < 0)
>  		goto out;
>  
>  	if (fd < 0 || fd >= INT_MAX)


      reply	other threads:[~2024-11-17 12:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15  8:00 Daniel Yang
2024-11-17 12:30 ` Joseph Qi [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=6a9c30d7-dce1-4323-bd48-0bef8084d5ea@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=danielyangkang@gmail.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®