All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Engelhardt <jengelh@inai.de>
To: lucas.demarchi@intel.com
Cc: jengelh@inai.de, linux-modules@vger.kernel.org
Subject: [PATCH] kmod: build: cure compiler warnings showing up externally
Date: Sat, 16 Jun 2018 08:45:20 +0200	[thread overview]
Message-ID: <20180616064520.6426-1-jengelh@inai.de> (raw)

When building a C source file with gcc-7 -Wshift-overflow=2, this warning
springs up:

libkmod.h: warning: result of "1 << 31" requires 33 bits to
represent, but "int" only has 32 bits [-Wshift-overflow=]

Change the two _KMOD_* identifiers to fit into 32 bits.
---
 libkmod/libkmod.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h
index f9e33c6..352627e 100644
--- a/libkmod/libkmod.h
+++ b/libkmod/libkmod.h
@@ -72,7 +72,7 @@ enum kmod_index {
 	KMOD_INDEX_MODULES_SYMBOL,
 	KMOD_INDEX_MODULES_BUILTIN,
 	/* Padding to make sure enum is not mapped to char */
-	_KMOD_INDEX_PAD = (1 << 31),
+	_KMOD_INDEX_PAD = 1U << 31,
 };
 int kmod_dump_index(struct kmod_ctx *ctx, enum kmod_index type, int fd);
 
@@ -211,7 +211,7 @@ enum kmod_module_initstate {
 	KMOD_MODULE_COMING,
 	KMOD_MODULE_GOING,
 	/* Padding to make sure enum is not mapped to char */
-	_KMOD_MODULE_PAD = (1 << 31),
+	_KMOD_MODULE_PAD = 1U << 31,
 };
 const char *kmod_module_initstate_str(enum kmod_module_initstate state);
 int kmod_module_get_initstate(const struct kmod_module *mod);
-- 
2.17.1


             reply	other threads:[~2018-06-16  6:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-16  6:45 Jan Engelhardt [this message]
2018-06-18 16:49 ` [PATCH] kmod: build: cure compiler warnings showing up externally Lucas De Marchi

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=20180616064520.6426-1-jengelh@inai.de \
    --to=jengelh@inai.de \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.