All of lore.kernel.org
 help / color / mirror / Atom feed
* [char-misc-next] mei: bus: suppress sign-compare warnings
@ 2018-07-15 11:41 Tomas Winkler
  0 siblings, 0 replies; only message in thread
From: Tomas Winkler @ 2018-07-15 11:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alexander Usyskin, linux-kernel, Tomas Winkler

Comparison between signed and unsigned warnings
and associated type promotion may cause error
condition not be detected.
The type promotion issue in mei bus was addressed by two patches:
commit b40b3e9358fb ("mei: bus: type promotion bug in mei_nfc_if_version()")
commit cf1ed2c59b98 ("mei: bus: type promotion bug in mei_fwver()")
Now it is possible to suppress the warning, by adding proper
casting to move out of radar.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/bus-fixup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index 2b8390447117..a6f41f96f2a1 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -181,7 +181,7 @@ static int mei_fwver(struct mei_cl_device *cldev)
 	ret = 0;
 	bytes_recv = __mei_cl_recv(cldev->cl, buf, sizeof(buf), 0,
 				   MKHI_RCV_TIMEOUT);
-	if (bytes_recv < 0 || bytes_recv < MKHI_FWVER_LEN(1)) {
+	if (bytes_recv < 0 || (size_t)bytes_recv < MKHI_FWVER_LEN(1)) {
 		/*
 		 * Should be at least one version block,
 		 * error out if nothing found
@@ -193,7 +193,7 @@ static int mei_fwver(struct mei_cl_device *cldev)
 	fwver = (struct mkhi_fw_ver *)req->data;
 	memset(cldev->bus->fw_ver, 0, sizeof(cldev->bus->fw_ver));
 	for (i = 0; i < MEI_MAX_FW_VER_BLOCKS; i++) {
-		if (bytes_recv < MKHI_FWVER_LEN(i + 1))
+		if ((size_t)bytes_recv < MKHI_FWVER_LEN(i + 1))
 			break;
 		dev_dbg(&cldev->dev, "FW version%d %d:%d.%d.%d.%d\n",
 			i, fwver->ver[i].platform,
@@ -341,7 +341,7 @@ static int mei_nfc_if_version(struct mei_cl *cl,
 
 	ret = 0;
 	bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length, 0, 0);
-	if (bytes_recv < 0 || bytes_recv < if_version_length) {
+	if (bytes_recv < 0 || (size_t)bytes_recv < if_version_length) {
 		dev_err(bus->dev, "Could not read IF version\n");
 		ret = -EIO;
 		goto err;
-- 
2.14.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-15 11:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-15 11:41 [char-misc-next] mei: bus: suppress sign-compare warnings Tomas Winkler

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.