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]
Date:   Mon, 16 Oct 2017 08:51:22 +0900
From:   Masanori Goto <gotom@...ian.or.jp>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     YOKOTA Hiroshi <yokota@...lab.is.tsukuba.ac.jp>,
        "James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Hannes Reinecke <hare@...e.com>,
        Johannes Thumshirn <jthumshirn@...e.de>,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scsi: nsp32: fix logic bug in error handling

2017-09-05 16:51 GMT+09:00 Arnd Bergmann <arnd@...db.de>:
> gcc-8 points out a logic error that has existed since the start
> of the git history:
>
> drivers/scsi/nsp32.c: In function 'nsp32_selection_autoscsi':
> drivers/scsi/nsp32.c:607:27: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
>   if(((phase & BUSMON_BSY) == 1) || (phase & BUSMON_SEL) == 1) {
>                            ^~
>
> Presumably the author intended to check if one of two bits was
> set, so that's what I'm changing the code to. This will obviously
> change the behavior of the code, hopefully to do the right thing,
> but I have not tested this or checked if the new "(phase & BUSMON_BSY)
> || (phase & BUSMON_SEL)" condition should indeed be treated as a
> fatal error.
>

This is what I originally intended to, thank you!

Signed-off-by: GOTO Masanori <gotom@...ian.or.jp>

> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  drivers/scsi/nsp32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
> index 107e191bf023..8620ac5d6e41 100644
> --- a/drivers/scsi/nsp32.c
> +++ b/drivers/scsi/nsp32.c
> @@ -604,7 +604,7 @@ static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
>          * check bus line
>          */
>         phase = nsp32_read1(base, SCSI_BUS_MONITOR);
> -       if(((phase & BUSMON_BSY) == 1) || (phase & BUSMON_SEL) == 1) {
> +       if ((phase & BUSMON_BSY) || (phase & BUSMON_SEL)) {
>                 nsp32_msg(KERN_WARNING, "bus busy");
>                 SCpnt->result = DID_BUS_BUSY << 16;
>                 status = 1;
> --
> 2.9.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ