linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: fpga-mgr: Fix undefined behavior
@ 2022-04-21 14:39 Moritz Fischer
  2022-04-21 14:57 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Moritz Fischer @ 2022-04-21 14:39 UTC (permalink / raw)
  To: linux-fpga; +Cc: jgg, yilun.xu, hao.wu, Moritz Fischer

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(-)

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;
-- 
2.36.0


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

* Re: [PATCH] fpga: fpga-mgr: Fix undefined behavior
  2022-04-21 14:39 [PATCH] fpga: fpga-mgr: Fix undefined behavior Moritz Fischer
@ 2022-04-21 14:57 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2022-04-21 14:57 UTC (permalink / raw)
  To: Moritz Fischer; +Cc: linux-fpga, yilun.xu, hao.wu

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

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

end of thread, other threads:[~2022-04-21 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-21 14:39 [PATCH] fpga: fpga-mgr: Fix undefined behavior Moritz Fischer
2022-04-21 14:57 ` Jason Gunthorpe

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).