rmc: fix allocating buffer issue in read_file() (32 bit)
PATCH 1/1 rmc: fix allocating buffer issue in read_file() (32 bit)
Runtime test script failed on T100TA (32 bit) machine because read_file() function in rmc.c gets a wrong value of st_size from the buffer returned by stat(). We include rmc header files prior to the rest of standard header files in rmc.c, so standard data subsequently defined could be affected by "#pragma pack(1)" in rmc header files.
Runtime test passes on T100TA and other two boards with this change.
--- src/rmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
src/rmc.c +2 -2
@@ -10,8 +10,6 @@#include <stdio.h> #include <unistd.h> #include <ctype.h> -#include <rmcl.h> -#include <rsmp.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h>
@@ -20,6 +18,8 @@#include <sys/stat.h> #include <sys/mman.h> +#include <rmcl.h> +#include <rsmp.h> #define USAGE "RMC (Runtime Machine configuration) Tool\n" \ "NOTE: Most of usages require root permission (sudo)\n" \
Signature · 1 line
2.7.4
Quoted 9 lines · Jianxun Zhang
Runtime test script failed on T100TA (32 bit) machine because
read_file()function inrmc.cgets a wrong value ofst_sizefrom the buffer returned bystat(). We include rmc header files prior to the rest of standard header files inrmc.c, so standard data subsequently defined could be affected by "#pragma pack(1)" in rmc header files.
perhaps resetting the pragma would make it independent of positioning sequence ?
Quoted 38 lines
Runtime test passes on T100TA and other two boards with this change.
Signed-off-by Jianxun Zhang <[email protected]>---
src/rmc.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)src/rmc.c +2
-3@@ -10,8 +10,6 @@#include <stdio.h> #include <unistd.h> #include <ctype.h> -#include <rmcl.h> -#include <rsmp.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -20,6 +18,8 @@#include <sys/stat.h> #include <sys/mman.h> +#include <rmcl.h> +#include <rsmp.h> #define USAGE "RMC (Runtime Machine configuration) Tool\n" \ "NOTE: Most of usages require root permission (sudo)\n" \ --2.7.4
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Quoted 14 lines · Khem Raj
Quoted 10 lines · Jianxun Zhang
Runtime test script failed on T100TA (32 bit) machine because
read_file()function inrmc.cgets a wrong value ofst_sizefrom the buffer returned bystat(). We include rmc header files prior to the rest of standard header files inrmc.c, so standard data subsequently defined could be affected by "#pragma pack(1)" in rmc header files.
Quoted 1 line
perhaps resetting the pragma would make it independent of positioning sequence ?
Khem,
Good suggestion. I think pragma pack(push,1) and pop should be a solution. I will try it and submit a V2 if test passes.
Thanks
Quoted 39 lines
Quoted 38 lines
Runtime test passes on T100TA and other two boards with this change.
Signed-off-by Jianxun Zhang <[email protected]>---
src/rmc.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)src/rmc.c +2
-3@@ -10,8 +10,6 @@#include <stdio.h> #include <unistd.h> #include <ctype.h> -#include <rmcl.h> -#include <rsmp.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -20,6 +18,8 @@#include <sys/stat.h> #include <sys/mman.h> +#include <rmcl.h> +#include <rsmp.h> #define USAGE "RMC (Runtime Machine configuration) Tool\n" \ "NOTE: Most of usages require root permission (sudo)\n" \ --2.7.4
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto