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>] [day] [month] [year] [list]
Date:   Fri, 17 Dec 2021 08:51:49 -0800
From:   Jaegeuk Kim <jaegeuk@...nel.org>
To:     "Yang.Lee" <yang.lee@...ux.alibaba.com>
Cc:     chao <chao@...nel.org>,
        linux-f2fs-devel <linux-f2fs-devel@...ts.sourceforge.net>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Abaci Robot <abaci@...ux.alibaba.com>
Subject: Re: 回复:[PATCH -next] f2fs:
 Simplify bool conversion

On 12/17, Yang.Lee wrote:
> "Why not this?
>   sbi->gc_urgent_high_limited = t;"
> 
> Since 't' is an unsigned long type and 'gc_urgent_high_limited' is a bool type, the assignment operation will cause a new warning.

Huh, that doesn't allow auto casting as well.

> 
> 
> ------------------------------------------------------------------
> 发件人:Jaegeuk Kim <jaegeuk@...nel.org>
> 发送时间:2021年12月17日(星期五) 03:27
> 收件人:Yang Li <yang.lee@...ux.alibaba.com>
> 抄 送:chao <chao@...nel.org>; linux-f2fs-devel <linux-f2fs-devel@...ts.sourceforge.net>; linux-kernel <linux-kernel@...r.kernel.org>; Abaci Robot <abaci@...ux.alibaba.com>
> 主 题:Re: [PATCH -next] f2fs: Simplify bool conversion
> 
> On 12/15, Yang Li wrote:
> > Fix the following coccicheck warning:
> > ./fs/f2fs/sysfs.c:491:41-46: WARNING: conversion to bool not needed here
> > 
> > Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
> > Signed-off-by: Yang Li <yang.lee@...ux.alibaba.com>
> > ---
> >  fs/f2fs/sysfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > index 9e1cf44642ae..530c36b89bf1 100644
> > --- a/fs/f2fs/sysfs.c
> > +++ b/fs/f2fs/sysfs.c
> > @@ -488,7 +488,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
> >  
> >   if (!strcmp(a->attr.name, "gc_urgent_high_remaining")) {
> >    spin_lock(&sbi->gc_urgent_high_lock);
> > -  sbi->gc_urgent_high_limited = t == 0 ? false : true;
> > +  sbi->gc_urgent_high_limited = t != 0;
> 
> Why not this?
>   sbi->gc_urgent_high_limited = t;
> 
> >    sbi->gc_urgent_high_remaining = t;
> >    spin_unlock(&sbi->gc_urgent_high_lock);
> >  
> > -- 
> > 2.20.1.7.g153144c
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ