Re: PATCHes

2020-09-15 Thread Aschref Ben-Thabet
, Aschref Ben Thabet Embedded Brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel

[PATCH] display/disp_hcms29xx: Fix string truncation warning

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Strncpy() is unsafe if the terminating NUL is missing. Replace it by the safer strlcpy() and fix the string truncation warning,since the strlcpy() function returns the total length of the string it tried to create,that means: the length of src. --- bsps/shared/dev

[PATCH] rtems/printer.h: Fix build warnings -Wclass-memaccess

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Cast to (void *) to silence the warning. --- cpukit/include/rtems/printer.h | 4 1 file changed, 4 deletions(-) diff --git a/cpukit/include/rtems/printer.h b/cpukit/include/rtems/printer.h index 310937cc2f..25c6f27960 100644 --- a/cpukit/include/rtems/printer.h

[PATCH] cpukit/libblock/bdpart-register.c: Fix string truncation warning.

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Replace strncpy() with memcpy() to guarantee a safe copying of characters. --- cpukit/libblock/src/bdpart-mount.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cpukit/libblock/src/bdpart-mount.c b/cpukit/libblock/src/bdpart-mount.c

[PATCH] cpukit/libblock/bdpart-register.c: Fix string truncation warning.

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Replace strncpy() with memcpy() to guarantee a safe copying of characters. --- cpukit/libblock/src/bdpart-register.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpukit/libblock/src/bdpart-register.c b/cpukit/libblock/src/bdpart-register.c index

[PATCH] Fix fdt string warnings

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet --- cpukit/libmisc/rtems-fdt/rtems-fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt.c b/cpukit/libmisc/rtems-fdt/rtems-fdt.c index 39e70bffec..d2b412ceb0 100644 --- a/cpukit/libmisc/rtems-fdt/rtems-fdt.c +++ b

[PATCH] cpukit/libmisc/shell: Fix string truncation warning

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Strncpy() is considered unsafe as the resulting string may not be NULL terminated. In addition it fills the unused part of the destination buffer unnecessarily with NULL bytes. Strlcpy() is designed to solve the null-termination problemsi,it always null-terminates. It’s

[PATCH] cpukit/mghttpd/mongoose: Fix format truncation warning

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Taking care of the size of buffer to be copied and replace the unsafe snprintf() with memcpy(). The reason why we get a warning on sprintf() is because memcpy() has a length parameter that limits how much memory you copy. For memcpy(), the input has to be terminated

[PATCH] cpukit/libmisc/shell/shell.c: Fix restrict warning

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Replace the unsafe function strcpy() with memmove() to avoid the string restrict warning. Since memmove() function is used to copy a specified number of bytes from one memory to another or to overlap on same memory. --- cpukit/libmisc/shell/shell.c | 10 +- 1

[PATCH] testsuites/fstests/dos: Fix format truncation warning

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Replace the snprintf() code line with memcpy() and strcpy(). First copy the MOUNT_DIR to dirname and add the '/' character, then copy the invalide directory name. --- testsuites/fstests/fsdosfsname01/init.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions

[PATCH] testsuits/dl10 : Prototype missing

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Add a prototype for the function rtems_main_o5() to avoid the prototype missing warning. --- testsuites/libtests/dl10/dl10-o6.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuites/libtests/dl10/dl10-o6.c b/testsuites/libtests/dl10/dl10-o6.c

[PATCH] cpukit/libmisc/capture: Fix unaligned pointer value warning

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Change the function ctrace_task_name_add() to take the variable name as a value instead a pointer. It avoids the warning and solve the issue. --- cpukit/libmisc/capture/capture_support.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpukit

[PATCH] Psxtest: Fix String truncation warning

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Replace strncpy() with strdup() to silence this warning since it tries to allocate enough memory to hold the old string (plus a '\0' character to mark the end of the string). --- testsuites/psxtests/psxndbm01/init.c | 11 +++ 1 file changed, 3 insertions(+), 8

[PATCH] cpukit/libmisc/monitor: Fix string restrict warning

2020-09-15 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Replace strcpy with the safer memcpy(). The strcpy() function is designed to work exclusively with strings. strcpy() copies each byte of the source string to the destination string and stops when the terminating null character (\0) has been moved. On the other hand

[PATCH] cpukit/libmisc/shell: Fix string turncation warning

2020-09-04 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet strncpy is considered unsafe as the resulting string may not be NULL terminated. In addition it fills the unused part of the destination buffer unnecessarily with NULL bytes. strlcpy is designed to solve the null-termination problems – it always null-terminates. It’s

[PATCH] display/disp_hcms29xx fix string turncation warning

2020-09-03 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet strncpy is unsafe if the terminating NULL is missing, as it may copy more characters than fit in the destination area Replace it by the safer strlcpy() and fix the string turncation warnings. --- bsps/shared/dev/display/disp_hcms29xx.c | 3 +-- 1 file changed, 1

[PATCH v2] testsuits/dl10 : Prototype missing

2020-08-31 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Add a prototype for the function rtems_main_o5 to avoid the prototype missing warning. --- testsuites/libtests/dl10/dl10-o6.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuites/libtests/dl10/dl10-o6.c b/testsuites/libtests/dl10/dl10-o6.c

[PATCH] testsuits/dl10 : Prototype missing

2020-08-31 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Add a prototxpe for the function rtems_main_o5 to avoid the prototype missing warning. --- testsuites/libtests/dl10/dl10-o6.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuites/libtests/dl10/dl10-o6.c b/testsuites/libtests/dl10/dl10-o6.c

[PATCH] psxkey01: Fix configuration

2020-08-18 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Key_ID array must have the right size, it shall have a value greater than zero. Note: In Standard C and C++, zero-size array is not allowed.. --- testsuites/psxtests/psxkey01/system.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuites

[PATCH] Fix -Wchar-subscripts warnings

2020-08-18 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet The argument to the ctype functions must be an int and the value of the character must be representable as an unsigned char or equal to the value of the macro EOF. If the argument has any other value, the behavior is undefined. --- cpukit/libdl/rtl-archive.c

[PATCH v4] Psxtest : Fix String Turncation warning

2020-08-13 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet replace strncpy with strdup to silence this warning since it tries to allocate enough memory to hold the old string (plus a '\0' character to mark the end of the string). --- testsuites/psxtests/psxndbm01/init.c | 5 + 1 file changed, 1 insertion(+), 4 deletions

Re: [PATCH v2] cpukit: Edit String Warninng

2020-08-13 Thread Aschref Ben-Thabet
Sorry it was not against master ! i send then V3 for this patch. On 8/13/20 5:19 PM, Aschref Ben-Thabet wrote: From: Aschref Ben Thabet Using FILENAME_MAX as a parameter in strncpy function can gererate warnings of type: -Wstringop-truncation. Replacing it with sizeof (distination_buffer) can

[PATCH v3] cpukit: Edit String Warninng

2020-08-13 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Using FILENAME_MAX as a parameter in strncpy function can gererate warnings of type: -Wstringop-truncation. Replacing it with sizeof (distination_buffer) can avoid this warning. --- cpukit/libmisc/shell/main_edit.c | 9 + 1 file changed, 5 insertions(+), 4

[PATCH v2] cpukit: Edit String Warninng

2020-08-13 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Using FILENAME_MAX as a parameter in strncpy function can gererate warnings of type: -Wstringop-truncation. Replacing it with sizeof (distination_buffer) can avoid this warning. --- cpukit/libmisc/shell/main_edit.c | 11 ++- 1 file changed, 6 insertions(+), 5

[PATCH v3] Psxtest : Fix String Turncation warning

2020-08-13 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet replace strncpy with strdup to silence this warning since it tries to allocate enough memory to hold the old string (plus a '\0' character to mark the end of the string). ddd --- testsuites/psxtests/psxndbm01/init.c | 5 + 1 file changed, 1 insertion(+), 4

[PATCH 2/2] Psxtest : Fix String Turncation warning

2020-08-12 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet replace strncpy with strdup to silence this warning since it tries to allocate enough memory to hold the old string (plus a '\0' character to mark the end of the string). --- testsuites/psxtests/psxndbm01/init.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions

Re: [PATCH] Psxtest : Fix String Turncation warning

2020-08-12 Thread Aschref Ben-Thabet
t 7:03 AM Joel Sherrill mailto:j...@rtems.org>> wrote: > > > > On Wed, Aug 12, 2020 at 7:07 AM Aschref Ben-Thabet mailto:aschref.ben-tha...@embedded-brains.de>> wrote: >> >> From: Aschref Ben Thabet mailto:aschref.ben-tha...

[PATCH] Psxtest : Fix String Turncation warning

2020-08-12 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet replace strncpy with memcpy to silence this warning and free the allocated memory block. --- testsuites/psxtests/psxndbm01/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuites/psxtests/psxndbm01/init.c b/testsuites/psxtests/psxndbm01

[PATCH v2] rtems/printer.h Fix build warnings -Wclass-memaccess

2020-08-11 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet --- cpukit/include/rtems/printer.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cpukit/include/rtems/printer.h b/cpukit/include/rtems/printer.h index dbd887221e..310937cc2f 100644 --- a/cpukit/include/rtems/printer.h +++ b/cpukit/include

[PATCH v2] libtests/dl10: Delete unused functions

2020-08-11 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet --- v2: Removed double blank line. testsuites/libtests/dl10/dl-load.c | 22 -- 1 file changed, 22 deletions(-) diff --git a/testsuites/libtests/dl10/dl-load.c b/testsuites/libtests/dl10/dl-load.c index dee1d6e9cc..7a4bae9c17 100644

[PATCH] psxhdrs/strncpy/stpncpy: Fix string turncation warning

2020-08-05 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet Since we need to test the strncpy function, using a character array with a fixed array size in this case in place of character pointer can avoid the string turncation warning. --- testsuites/psxtests/psxhdrs/string/stpncpy.c | 7 +++ testsuites/psxtests/psxhdrs

[PATCH] fix Wunused-function deleting unused static functions in dl_tests

2020-08-05 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet the functions dl_close and dl_call are not needed for this test, deleting them will avoid the warning of Wunused-function. --- testsuites/libtests/dl10/dl-load.c | 21 - 1 file changed, 21 deletions(-) diff --git a/testsuites/libtests/dl10/dl

[PATCH] psxhdrs_strncpy_fix string_turncation_warning

2020-08-05 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet since we need to test the strncpy function, using a character array with a fixed array size in this case in place of character pointer can avoid the string turncation warning. --- testsuites/psxtests/psxhdrs/string/stpncpy.c | 8 testsuites/psxtests/psxhdrs

unused static functions

2020-08-04 Thread Aschref Ben-Thabet
", func); return1; } call (); return0; } Beste regards Aschref Ben thabet Embedded Brains GmbH ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel

[PATCH 2/2] Fix warning -Wchar-subscripts in isspace() and isdigit()

2020-08-03 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet The warning may be because you're passing a char to the isspace() macro. The implementation of isspace() may be via array indexing. This means that the index for the array can be negative. This can be a problem as a char could represent a signed value, and you may

[PATCH] Fix warning -Wchar-subscripts in isspace() and isdigit() macro

2020-08-03 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet The warning may be because you're passing a char to the isspace() macro. The implementation of isspace() may be via array indexing. (The argument to the isspace()/isdegit() macro is defined to be an unsigned char the value of which can fit in an unsignedchar

[PATCH] rtems/printer.h Fix build warnings -Wclass-memaccess

2020-07-30 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet --- cpukit/include/rtems/printer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpukit/include/rtems/printer.h b/cpukit/include/rtems/printer.h index dbd887221e..fc091ffda3 100644 --- a/cpukit/include/rtems/printer.h +++ b/cpukit/include/rtems

[PATCH] psxhdrs/strncat: Fix string truncation warning

2020-07-30 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet --- testsuites/psxtests/psxhdrs/string/strncat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuites/psxtests/psxhdrs/string/strncat.c b/testsuites/psxtests/psxhdrs/string/strncat.c index 730a56cfa6..d872be3408 100644 --- a/testsuites

[PATCH] psxhdrs/strncat: Fix string truncation warning

2020-07-30 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet --- testsuites/psxtests/psxhdrs/string/strncat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuites/psxtests/psxhdrs/string/strncat.c b/testsuites/psxtests/psxhdrs/string/strncat.c index 730a56cfa6..d872be3408 100644 --- a/testsuites

[PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet GCC 10 warns about an overlapping using strncpy. -> Replace some calls of strncpy with a memcpy to avoid this issue. --- cpukit/libblock/src/bdpart-mount.c | 4 ++-- testsuites/psxtests/psxndbm01/init.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) d

[PATCH v3] Fix warning in isspace() and isdigit().

2020-07-20 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet The warning may be because you're passing a char to the isspace() macro. The implementation of isspace() may be via array indexing. (The argument to the isspace()/isdegit() macro is defined to be an unsigned char the value of which can fit in an unsignedchar

[PATCH v2] Fix warning in isspace() and isdigit().

2020-07-20 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet The warning may be because you're passing a char to the isspace() macro. The implementation of isspace() may be via array indexing. (The argument to the isspace()/isdegit() macro is defined to be an unsigned char the value of which can fit in an unsignedchar

[PATCH] The warning may be because you're passing a char to the isspace() macro. The implementation of isspace() may be via array indexing. (The argument to the isspace()/isdegit() macro is defined to

2020-07-20 Thread Aschref Ben-Thabet
From: Aschref Ben Thabet at ctype.h in GNU libc, and while there's a complicated mess of macros and functions, somewhere in the definition of isspace() there's an array being indexed. See if isspace((unsigned char) *str) gets rid of the warning. The line array[c] is very likely a bug

[PATCH] sptests/sp21: Fix deprecated warning

2020-07-07 Thread Aschref Ben-Thabet
--- testsuites/sptests/sp21/init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testsuites/sptests/sp21/init.c b/testsuites/sptests/sp21/init.c index f44f2ba851..71abe467a9 100644 --- a/testsuites/sptests/sp21/init.c +++ b/testsuites/sptests/sp21/init.c @@ -7,6 +7,8 @@ *