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-next>] [day] [month] [year] [list]
Date:	Thu, 21 Jul 2016 09:40:06 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Tejun Heo <tj@...nel.org>
Cc:	Arnd Bergmann <arnd@...db.de>, Hannes Reinecke <hare@...e.de>,
	Tom Yan <tom.ty89@...il.com>, linux-ide@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] libata: add parentheses to avoid a gcc warning

gcc-6.1 warns about possibly ambiguous code that was newly added
to libata:

drivers/ata/libata-scsi.c: In function 'ata_mselect_caching':
drivers/ata/libata-scsi.c:3637:28: error: suggest parentheses around comparison in operand of '&' [-Werror=parentheses]
drivers/ata/libata-scsi.c: In function 'ata_mselect_control':
drivers/ata/libata-scsi.c:3702:28: error: suggest parentheses around comparison in operand of '&' [-Werror=parentheses]

The code is fine, and it's not really ambigous to human readers,
but let's shut up the warning anyway by adding the parentheses
that gcc suggests.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
Fixes: 9b7844a8c34a ("libata-scsi: fix read-only bits checking in ata_mselect_*()")
---
 drivers/ata/libata-scsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index fa9d16fe295c..8ad4b237f342 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3634,7 +3634,7 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
 		/* Check the first byte */
 		if (i == 0) {
 			/* except the WCE bit */
-			if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
+			if ((mpage[i + 2] & 0xfb) != (buf[i] & 0xfb)) {
 				*fp = i;
 				return -EINVAL;
 			} else {
@@ -3699,7 +3699,7 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
 		/* Check the first byte */
 		if (i == 0) {
 			/* except the D_SENSE bit */
-			if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
+			if ((mpage[i + 2] & 0xfb) != (buf[i] & 0xfb)) {
 				*fp = i;
 				return -EINVAL;
 			} else {
-- 
2.9.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ