From: Colin King <colin.king@canonical.com>
To: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>,
David E Box <david.e.box@intel.com>,
Hans de Goede <hdegoede@redhat.com>,
Mark Gross <mgross@linux.intel.com>,
platform-driver-x86@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][next] platform/x86: intel_pmc_core: fix unsigned variable compared to less than zero
Date: Tue, 20 Apr 2021 13:10:44 +0100 [thread overview]
Message-ID: <20210420121044.379350-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
The check for ret < 0 is always false because ret is a (unsigned) size_t
and not a (signed) ssize_t, hence simple_write_to_buffer failures are
never detected. Fix this by making ret a ssize_t
Addresses-Coverity: ("Unsigned compared against 0")
Fixes: 8074a79fad2e ("platform/x86: intel_pmc_core: Add option to set/clear LPM mode")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/platform/x86/intel_pmc_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c
index 3ae00ac85c75..d174aeb492e0 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -1360,7 +1360,7 @@ static ssize_t pmc_core_lpm_latch_mode_write(struct file *file,
struct pmc_dev *pmcdev = s->private;
bool clear = false, c10 = false;
unsigned char buf[8];
- size_t ret;
+ ssize_t ret;
int idx, m, mode;
u32 reg;
--
2.30.2
next reply other threads:[~2021-04-20 12:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-20 12:10 Colin King [this message]
2021-04-20 15:02 ` [PATCH][next] platform/x86: intel_pmc_core: fix unsigned variable compared to less than zero Hans de Goede
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=20210420121044.379350-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=david.e.box@intel.com \
--cc=hdegoede@redhat.com \
--cc=irenic.rajneesh@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@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).