Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH] axis-fifo: use size_t for write size calculations
@ 2026-07-31  3:43 Lucas Jeffrey
  2026-07-31 11:10 ` Dan Carpenter
  2026-08-01 17:36 ` [PATCH v2] staging: " Lucas Jeffrey
  0 siblings, 2 replies; 3+ messages in thread
From: Lucas Jeffrey @ 2026-07-31  3:43 UTC (permalink / raw)
  To: gregkh
  Cc: ovidiu.panait.oss, gustavopiazdasilva2102, error27, linux-staging,
	linux-kernel, Lucas Jeffrey

The write length is provided as size_t, but words_to_write and the
return value storage used narrower types. Use size_t for the word count
and ssize_t for the return value to keep the types consistent with the
write interface.

This avoids relying on implicit size limits when handling write sizes.

Signed-off-by: Lucas Jeffrey <luquijeffrey@gmail.com>
---
 drivers/staging/axis-fifo/axis-fifo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
index 3aa2aa870ea9..d2b30b7b6845 100644
--- a/drivers/staging/axis-fifo/axis-fifo.c
+++ b/drivers/staging/axis-fifo/axis-fifo.c
@@ -214,9 +214,9 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
 			       size_t len, loff_t *off)
 {
 	struct axis_fifo *fifo = f->private_data;
-	unsigned int words_to_write;
+	size_t words_to_write;
 	u32 *txbuf;
-	int ret;
+	ssize_t ret;
 
 	words_to_write = len / sizeof(u32);
 
@@ -257,7 +257,7 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
 		goto end_unlock;
 	}
 
-	for (int i = 0; i < words_to_write; ++i)
+	for (size_t i = 0; i < words_to_write; ++i)
 		iowrite32(txbuf[i], fifo->base_addr + XLLF_TDFD_OFFSET);
 
 	iowrite32(len, fifo->base_addr + XLLF_TLR_OFFSET);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-01 17:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31  3:43 [PATCH] axis-fifo: use size_t for write size calculations Lucas Jeffrey
2026-07-31 11:10 ` Dan Carpenter
2026-08-01 17:36 ` [PATCH v2] staging: " Lucas Jeffrey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox