linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Austin Kim <austindh.kim@gmail.com>
To: marek.behun@nic.cz
Cc: linux-kernel@vger.kernel.org, austindh.kim@gmail.com
Subject: [PATCH] bus: moxtet: Update proper type 'size_t' to 'ssize_t'
Date: Wed, 11 Sep 2019 14:59:38 +0900	[thread overview]
Message-ID: <20190911055938.GA130589@LGEARND20B15> (raw)

The simple_write_to_buffer() returns ssize_t type value,
which is either positive or negative.

However 'res' is declared as size_t(unsigned int)
which contains non-negative type.

So 'res < 0' statement is always false,
this cannot execute execptional-case  handling.

To prevent this case,
update proper type 'size_t' to 'ssize_t' for execptional handling.

Signed-off-by: Austin Kim <austindh.kim@gmail.com>
---
 drivers/bus/moxtet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/moxtet.c b/drivers/bus/moxtet.c
index 1ee4570..288a9e4 100644
--- a/drivers/bus/moxtet.c
+++ b/drivers/bus/moxtet.c
@@ -514,7 +514,7 @@ static ssize_t output_write(struct file *file, const char __user *buf,
 	struct moxtet *moxtet = file->private_data;
 	u8 bin[TURRIS_MOX_MAX_MODULES];
 	u8 hex[sizeof(bin) * 2 + 1];
-	size_t res;
+	ssize_t res;
 	loff_t dummy = 0;
 	int err, i;
 
-- 
2.6.2


             reply	other threads:[~2019-09-11  5:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11  5:59 Austin Kim [this message]
2019-09-11 13:12 ` [PATCH] bus: moxtet: Update proper type 'size_t' to 'ssize_t' Marek Behun
2019-09-11 13:48   ` Austin Kim

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=20190911055938.GA130589@LGEARND20B15 \
    --to=austindh.kim@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marek.behun@nic.cz \
    /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).