diff mbox series

fpga: fpga-mgr: Fix undefined behavior

Message ID 20220421143924.68443-1-mdf@kernel.org (mailing list archive)
State New
Headers show
Series fpga: fpga-mgr: Fix undefined behavior | expand

Commit Message

Moritz Fischer April 21, 2022, 2:39 p.m. UTC
Incrementing void pointers is undefined behavior.

Fixes: baa6d3966351 ("fpga: Add scatterlist based programming")
Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
 drivers/fpga/fpga-mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jason Gunthorpe April 21, 2022, 2:57 p.m. UTC | #1
On Thu, Apr 21, 2022 at 07:39:24AM -0700, Moritz Fischer wrote:
> Incrementing void pointers is undefined behavior.

AFIACR in the kernel dialect of C this is defined behavior..

Jason
diff mbox series

Patch

diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index 6bd018f20793..3d9b8722f5ce 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -299,7 +299,7 @@  static int fpga_mgr_buf_load(struct fpga_manager *mgr,
 {
 	struct page **pages;
 	struct sg_table sgt;
-	const void *p;
+	const char *p;
 	int nr_pages;
 	int index;
 	int rc;