fpga: Replace char * with const char * for filename
Subsystems (2)
PATCH 1/1 fpga: Replace char * with const char * for filename
From: Tien Fong Chee <[email protected]>
Ensure the string for filename is always constant, otherwise it can be corrupted by the writing.
--- drivers/fpga/zynqpl.c | 3 ++- include/fpga.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/fpga/zynqpl.c +2 -1
@@ -421,7 +421,8 @@ static int zynq_loadfs(xilinx_desc *desc, const void *buf, size_t bsize,loff_t blocksize, actread;loff_t pos =0 ;int fstype; -char *interface, *dev_part, *filename; +char *interface, *dev_part; +const char *filename; blocksize = fsinfo->blocksize; interface = fsinfo->interface;
include/fpga.h +1 -1
@@ -41,7 +41,7 @@ typedef struct { /* typedef fpga_desc */unsigned int blocksize;char *interface;char *dev_part; -char *filename; +const char *filename;int fstype; } fpga_fs_info;
Signature · 1 line
1.7.7.4
PATCH 1/1 fpga: Replace char * with const char * for filename
Quoted 4 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Ensure the string for filename is always constant, otherwise it can be corrupted by the writing.
Have you reach any issue with it?
Quoted 27 lines
Signed-off-by Tien Fong Chee <[email protected]>--- drivers/fpga/zynqpl.c | 3 ++- include/fpga.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)drivers/fpga/zynqpl.c +2
-1@@ -421,7 +421,8 @@ static int zynq_loadfs(xilinx_desc *desc, const void *buf, size_t bsize,loff_t blocksize, actread;loff_t pos =0 ;int fstype; -char *interface, *dev_part, *filename; +char *interface, *dev_part; +const char *filename; blocksize = fsinfo->blocksize; interface = fsinfo->interface;include/fpga.h +0
-0
include/fpga.h typedef struct { /* typedef fpga_desc */ · line 47
Quoted 8 lines
include/fpga.h +1
-1@@ -41,7 +41,7 @@ typedef struct { /* typedef fpga_desc */unsigned int blocksize;char *interface;char *dev_part; -char *filename; +const char *filename;int fstype; } fpga_fs_info;
Anyway looks good applied.
Thanks,
Michal
Chee
PATCH 1/1 fpga: Replace char * with const char * for filename
Quoted 8 lines · Michal Simek
Quoted 6 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Ensure the string for filename is always constant, otherwise it can be
corrupted by the writing.Have you reach any issue with it?
Just to resolve the compiler warning about missing of const.
Quoted 43 lines
Quoted 35 lines
Signed-off-by Tien Fong Chee <[email protected]>---
drivers/fpga/zynqpl.c | 3 ++-
include/fpga.h | 2 +-2 files changed, 3 insertions(+), 2 deletions(-)drivers/fpga/zynqpl.c +2
-1@@ -421,7 +421,8 @@ static int zynq_loadfs(xilinx_desc *desc, const void *buf, size_t bsize, loff_t blocksize, actread; loff_t pos = 0; int fstype; -char *interface, *dev_part, *filename; +char *interface, *dev_part; +const char *filename;
blocksize =fsinfo->blocksize;
interface =fsinfo->interface;include/fpga.h +0
-0@@ -41,7 +41,7 @@ typedef struct { /* typedef
fpga_desc*/
unsigned int blocksize;
char *interface;
char*dev_part;include/fpga.h +1
-1-char *filename; +const char *filename;Quoted 4 lines
int fstype;
}fpga_fs_info;Anyway looks good applied.
Thanks,
Michal
PATCH 1/1 fpga: Replace char * with const char * for filename
Quoted 10 lines · Tien Fong
Quoted 8 lines · Michal Simek
Quoted 6 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Ensure the string for filename is always constant, otherwise it can be
corrupted by the writing.Have you reach any issue with it?
Just to resolve the compiler warning about missing of const.
ok.
Thanks,
Michal