mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eli Billauer <eli.billauer@gmail.com>
To: gregkh@linuxfoundation.org
Cc: arnd@arndb.de, linux-kernel@vger.kernel.org,
	Eli Billauer <eli.billauer@gmail.com>
Subject: [PATCH 1/8] char: xillybus: Use unsigned int literal
Date: Mon,  9 Nov 2026 12:27:53 +0100	[thread overview]
Message-ID: <20261109112800.48663-2-eli.billauer@gmail.com> (raw)
In-Reply-To: <20261109112800.48663-1-eli.billauer@gmail.com>

Use "1U" rather than "1" left-shift operations in order to avoid signed
integer arithmetic, which has an undefined result if it wraps.

Assisted-by: Sashiko-0.2.5:gemini-3.1-pro-preview
Link: https://sashiko.dev/#/patchset/20260805093436.59740-1-eli.billauer%40gmail.com
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
---
 drivers/char/xillybus/xillyusb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/char/xillybus/xillyusb.c b/drivers/char/xillybus/xillyusb.c
index bd3babd39f35..56afb0a577af 100644
--- a/drivers/char/xillybus/xillyusb.c
+++ b/drivers/char/xillybus/xillyusb.c
@@ -381,13 +381,13 @@ static int fifo_init(struct xillyfifo *fifo,
 
 	if (log2_size > log2_fifo_buf_size) {
 		log2_bufnum = log2_size - log2_fifo_buf_size;
-		fifo->bufsize = 1 << log2_fifo_buf_size;
+		fifo->bufsize = 1U << log2_fifo_buf_size;
 	} else {
 		log2_bufnum = 0;
-		fifo->bufsize = 1 << log2_size;
+		fifo->bufsize = 1U << log2_size;
 	}
 
-	fifo->bufnum = 1 << log2_bufnum;
+	fifo->bufnum = 1U << log2_bufnum;
 	fifo->size = fifo->bufnum * fifo->bufsize;
 
 	if (!fifo->size || /* Unsigned integer overflow */
@@ -516,7 +516,7 @@ static struct xillyusb_endpoint
 	init_usb_anchor(&ep->anchor);
 	INIT_WORK(&ep->workitem, work);
 
-	ep->buffer_size = 1 << (PAGE_SHIFT + order);
+	ep->buffer_size = 1U << (PAGE_SHIFT + order);
 	ep->outstanding_urbs = 0;
 	ep->drained = true;
 	ep->wake_on_drain = false;
@@ -1320,7 +1320,7 @@ static int xillyusb_open(struct inode *inode, struct file *filp)
 		if (rc)
 			goto late_unopen;
 
-		out_ep->fill_mask = -(1 << chan->out_log2_element_size);
+		out_ep->fill_mask = -(1U << chan->out_log2_element_size);
 		chan->out_bytes = 0;
 		chan->flushed = 0;
 
-- 
2.17.1


  reply	other threads:[~2026-11-09 11:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 11:27 [PATCH 0/8] char: xillybus: Fix issues reported by Sashiko Eli Billauer
2026-11-09 11:27 ` Eli Billauer [this message]
2026-11-09 11:27 ` [PATCH 2/8] char: xillybus: Safer access of unaligned pointers Eli Billauer
2026-11-09 11:27 ` [PATCH 3/8] char: xillybus: Return error in fops read method handler Eli Billauer
2026-11-09 11:27 ` [PATCH 4/8] char: xillybus: Rely on FMODE flags in poll method Eli Billauer
2026-11-09 11:27 ` [PATCH 5/8] char: xillybus: Refactor flush function Eli Billauer
2026-11-09 11:27 ` [PATCH 6/8] char: xillybus: Correct handling of wait queue Eli Billauer
2026-11-09 11:27 ` [PATCH 7/8] char: xillybus: Avoid indefinite sleep of work item Eli Billauer
2026-11-09 11:28 ` [PATCH 8/8] char: xillybus: Cancel delayed work items before teardown Eli Billauer

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=20261109112800.48663-2-eli.billauer@gmail.com \
    --to=eli.billauer@gmail.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®