linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Hans de Goede <hdegoede@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] vboxsf: fix comparison of signed char constant with unsigned char array elements
Date: Tue, 15 Sep 2020 17:03:36 +0100	[thread overview]
Message-ID: <20200915160336.36107-1-colin.king@canonical.com> (raw)

From: Colin Ian King <colin.king@canonical.com>

The comparison of signed char constants with unsigned char array
elements leads to checks that are always false. Fix this by declaring
the VBSF_MOUNT_SIGNATURE_BYTE* macros as octal unsigned int constants
rather than as signed char constants. (Argueably the U is not necessarily
required, but add it to be really clear of intent).

Addresses-Coverity: ("Operands don't affect result")
Fixes: 0fd169576648 ("fs: Add VirtualBox guest shared folder (vboxsf) support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/vboxsf/super.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c
index 25aade344192..986efcb29cc2 100644
--- a/fs/vboxsf/super.c
+++ b/fs/vboxsf/super.c
@@ -21,10 +21,10 @@
 
 #define VBOXSF_SUPER_MAGIC 0x786f4256 /* 'VBox' little endian */
 
-#define VBSF_MOUNT_SIGNATURE_BYTE_0 ('\000')
-#define VBSF_MOUNT_SIGNATURE_BYTE_1 ('\377')
-#define VBSF_MOUNT_SIGNATURE_BYTE_2 ('\376')
-#define VBSF_MOUNT_SIGNATURE_BYTE_3 ('\375')
+#define VBSF_MOUNT_SIGNATURE_BYTE_0 0000U
+#define VBSF_MOUNT_SIGNATURE_BYTE_1 0377U
+#define VBSF_MOUNT_SIGNATURE_BYTE_2 0376U
+#define VBSF_MOUNT_SIGNATURE_BYTE_3 0375U
 
 static int follow_symlinks;
 module_param(follow_symlinks, int, 0444);
-- 
2.27.0


             reply	other threads:[~2020-09-15 22:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 16:03 Colin King [this message]
2020-09-16  6:14 ` [PATCH] vboxsf: fix comparison of signed char constant with unsigned char array elements Hans de Goede
2020-09-16  7:20   ` Sedat Dilek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200915160336.36107-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=hch@infradead.org \
    --cc=hdegoede@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).