lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <35b0534a-0ccd-4b92-b493-33434a81845e@linux.alibaba.com>
Date: Fri, 15 Nov 2024 09:05:26 +0800
From: Joseph Qi <joseph.qi@...ux.alibaba.com>
To: Daniel Yang <danielyangkang@...il.com>, Mark Fasheh <mark@...heh.com>,
 Joel Becker <jlbec@...lplan.org>,
 "open list:ORACLE CLUSTER FILESYSTEM 2 (OCFS2)"
 <ocfs2-devel@...ts.linux.dev>, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ocfs2: replace deprecated simple_strtol with kstrtol



On 11/13/24 4:09 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@...il.com>
> ---
>  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..dff18efbc 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,9 @@ 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')))
> +	int p_to_long_ret = kstrtol(p, 0, &fd);
> +

Please define at the beginning.
Seems we can just re-use 'ret'.
BTW, the blank line can be eleminated.

Thanks,
Joseph

> +	if (p_to_long_ret < 0)
>  		goto out;
>  
>  	if (fd < 0 || fd >= INT_MAX)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ