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: <YjVa7rJx7TuIo4gm@myhostname>
Date:   Sat, 19 Mar 2022 12:24:14 +0800
From:   Wan Jiabing <wanjiabing@...o.com>
To:     Tony Nguyen <anthony.l.nguyen@...el.com>
Cc:     Jesse Brandeburg <jesse.brandeburg@...el.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ice: use min() to make code cleaner in ice_gnss

On Fri, Mar 18, 2022 at 01:19:26PM -0700, Tony Nguyen wrote:
> 
> On 3/18/2022 2:46 AM, Wan Jiabing wrote:
> > Fix the following coccicheck warning:
> > ./drivers/net/ethernet/intel/ice/ice_gnss.c:79:26-27: WARNING opportunity for min()
> > 
> > Use min() to make code cleaner.
> > 
> > Signed-off-by: Wan Jiabing <wanjiabing@...o.com>
> 
> There are build issues with this patch:
> 
> In file included from ./include/linux/kernel.h:26,
>                  from drivers/net/ethernet/intel/ice/ice.h:9,
>                  from drivers/net/ethernet/intel/ice/ice_gnss.c:4:
> drivers/net/ethernet/intel/ice/ice_gnss.c: In function ‘ice_gnss_read’:
> ./include/linux/minmax.h:20:35: error: comparison of distinct pointer types
> lacks a cast [-Werror]
>    20 |         (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
>       |                                   ^~
> ./include/linux/minmax.h:26:18: note: in expansion of macro ‘__typecheck’
>    26 |                 (__typecheck(x, y) && __no_side_effects(x, y))
>       |                  ^~~~~~~~~~~
> ./include/linux/minmax.h:36:31: note: in expansion of macro ‘__safe_cmp’
>    36 |         __builtin_choose_expr(__safe_cmp(x, y), \
>       |                               ^~~~~~~~~~
> ./include/linux/minmax.h:45:25: note: in expansion of macro ‘__careful_cmp’
>    45 | #define min(x, y)       __careful_cmp(x, y, <)
>       |                         ^~~~~~~~~~~~~
> drivers/net/ethernet/intel/ice/ice_gnss.c:79:30: note: in expansion of macro
> ‘min’
>    79 |                 bytes_read = min(bytes_left, ICE_MAX_I2C_DATA_SIZE);
>       |                              ^~~
> cc1: all warnings being treated as errors
> 

Yes, sorry for the warning.

After check minmax.h, it's better to use min_t and there are no warnings.

Please check the new patch, thanks!

Wan Jiabing

View attachment "0001-ice-use-min_t-to-make-code-cleaner-in-ice_gnss.patch" of type "text/plain" (1173 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ