linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: lee.jones@linaro.org
Cc: stable@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/10] mfd: ab8500-debugfs: Fix incompatible types in comparison expression issue
Date: Wed, 24 Jun 2020 16:07:01 +0100	[thread overview]
Message-ID: <20200624150704.2729736-8-lee.jones@linaro.org> (raw)
In-Reply-To: <20200624150704.2729736-1-lee.jones@linaro.org>

Smatch reports:

 drivers/mfd/ab8500-debugfs.c:1804:20: error: incompatible types in comparison expression (different type sizes):
 drivers/mfd/ab8500-debugfs.c:1804:20:    unsigned int *
 drivers/mfd/ab8500-debugfs.c:1804:20:    unsigned long *

This is due to mixed types being compared in a min() comparison.  Fix
this by treating values as signed and casting them to the same type
as the receiving variable.

Cc: <stable@vger.kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/ab8500-debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c
index 1a9a3414d4fa8..6d1bf7c3ca3b1 100644
--- a/drivers/mfd/ab8500-debugfs.c
+++ b/drivers/mfd/ab8500-debugfs.c
@@ -1801,7 +1801,7 @@ static ssize_t ab8500_hwreg_write(struct file *file,
 	int buf_size, ret;
 
 	/* Get userspace string and assure termination */
-	buf_size = min(count, (sizeof(buf)-1));
+	buf_size = min((int)count, (int)(sizeof(buf)-1));
 	if (copy_from_user(buf, user_buf, buf_size))
 		return -EFAULT;
 	buf[buf_size] = 0;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-06-24 15:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-24 15:06 [PATCH 00/10] Fix a bunch of W=1 warnings in MFD Lee Jones
2020-06-24 15:06 ` [PATCH 01/10] mfd: twl4030-irq: Fix incorrect type in assignment warning Lee Jones
2020-06-24 15:06 ` [PATCH 02/10] mfd: twl4030-irq: Fix cast to restricted __le32 warning Lee Jones
2020-06-24 15:06 ` [PATCH 03/10] mfd: tps6586x: " Lee Jones
2020-06-24 15:06 ` [PATCH 04/10] mfd: altera-sysmgr: Fix physical address storing hacks Lee Jones
2020-07-01 19:33   ` Sasha Levin
2020-07-02  6:28     ` Lee Jones
2020-07-10 14:03   ` Sasha Levin
2020-06-24 15:06 ` [PATCH 05/10] mfd: sprd-sc27xx-spi: Fix symbol 'sprd_pmic_detect_charger_type' was not declared warning Lee Jones
2020-06-25  2:46   ` Baolin Wang
2020-06-24 15:07 ` [PATCH 06/10] mfd: ab3100-core: Fix incompatible types in comparison expression warning Lee Jones
2020-07-07 12:33   ` Linus Walleij
2020-06-24 15:07 ` Lee Jones [this message]
2020-07-07 12:34   ` [PATCH 07/10] mfd: ab8500-debugfs: Fix incompatible types in comparison expression issue Linus Walleij
2020-06-24 15:07 ` [PATCH 08/10] mfd: tc3589x: Remove invalid use of kerneldoc syntax Lee Jones
2020-06-24 15:07 ` [PATCH 09/10] mfd: wm8400-core: Supply description for wm8400_reset_codec_reg_cache's arg Lee Jones
2020-06-24 16:24   ` Charles Keepax
2020-06-24 15:07 ` [PATCH 10/10] mfd: wm831x-core: Supply description wm831x_reg_{un}lock args Lee Jones
2020-06-24 16:24   ` Charles Keepax

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=20200624150704.2729736-8-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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).