Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457799

linux-4.8-rc1/drivers/scsi/sd.c:317: pointless test ?

From David Binderman <linuxdev.baldrick@gmail.com>
Newsgroups linux.kernel
Subject linux-4.8-rc1/drivers/scsi/sd.c:317: pointless test ?
Date 2016-08-08 15:50 +0200
Message-ID <s3T6h-22X-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Hello there,

linux-4.8-rc1/drivers/scsi/sd.c:317]: (style) Unsigned variable 'val'
can't be negative so it is unnecessary to test it.

Source code is

    if (val >= 0 && val <= SD_DIF_TYPE3_PROTECTION)

but

   unsigned int val;

Suggest new code

    if (val <= SD_DIF_TYPE3_PROTECTION)

Regards

David Binderman

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

linux-4.8-rc1/drivers/scsi/sd.c:317: pointless test ? David Binderman <linuxdev.baldrick@gmail.com> - 2016-08-08 15:50 +0200
  Re: linux-4.8-rc1/drivers/scsi/sd.c:317: pointless test ? Laurence Oberman <loberman@redhat.com> - 2016-08-08 22:20 +0200

csiph-web