xen/string: address violations of MISRA C:2012 Rules 8.2 and 8.3

Add missing parameter names to address violations of
MISRA C:2012 Rule 8.2.

Resolve mismatches between parameter name "count" used in
"xen/lib/mem{cpy,move,set}.c" and parameter name "n" used in
"xen/arch/x86/string.c" to address violations of MISRA C:2012 Rule 8.3.

No functional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Federico Serafini authored and Stefano Stabellini committed 2023-11-17 18:07:26 -08:00
1 parent ab9558ef5e
commit a2e8d64c80
4 files changed
+32 -32

No files matched your search

+20 -20
View File
@@ -12,27 +12,27 @@
#define strncpy __xen_has_no_strncpy__
#define strncat __xen_has_no_strncat__
size_t strlcpy(char *, const char *, size_t);
size_t strlcat(char *, const char *, size_t);
int strcmp(const char *, const char *);
int strncmp(const char *, const char *, size_t);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
char *strchr(const char *, int);
char *strrchr(const char *, int);
char *strstr(const char *, const char *);
size_t strlen(const char *);
size_t strnlen(const char *, size_t);
char *strpbrk(const char *, const char *);
char *strsep(char **, const char *);
size_t strspn(const char *, const char *);
size_t strlcpy(char *dest, const char *src, size_t size);
size_t strlcat(char *dest, const char *src, size_t size);
int strcmp(const char *cs, const char *ct);
int strncmp(const char *cs, const char *ct, size_t count);
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t len);
char *strchr(const char *s, int c);
char *strrchr(const char *s, int c);
char *strstr(const char *s1, const char *s2);
size_t strlen(const char *s);
size_t strnlen(const char *s, size_t count);
char *strpbrk(const char *cs,const char *ct);
char *strsep(char **s, const char *ct);
size_t strspn(const char *s, const char *accept);
void *memset(void *, int, size_t);
void *memcpy(void *, const void *, size_t);
void *memmove(void *, const void *, size_t);
int memcmp(const void *, const void *, size_t);
void *memchr(const void *, int, size_t);
void *memchr_inv(const void *, int, size_t);
void *memset(void *s, int c, size_t n);
void *memcpy(void *dest, const void *src, size_t n);
void *memmove(void *dest, const void *src, size_t n);
int memcmp(const void *cs, const void *ct, size_t count);
void *memchr(const void *s, int c, size_t n);
void *memchr_inv(const void *s, int c, size_t n);
#include <asm/string.h>
+3 -3
View File
@@ -8,16 +8,16 @@
* memcpy - Copy one area of memory to another
* @dest: Where to copy to
* @src: Where to copy from
* @count: The size of the area.
* @n: The size of the area.
*
* You should not use this function to access IO space, use memcpy_toio()
* or memcpy_fromio() instead.
*/
void *(memcpy)(void *dest, const void *src, size_t count)
void *(memcpy)(void *dest, const void *src, size_t n)
{
char *tmp = (char *) dest, *s = (char *) src;
while (count--)
while (n--)
*tmp++ = *s++;
return dest;
+6 -6
View File
@@ -8,23 +8,23 @@
* memmove - Copy one area of memory to another
* @dest: Where to copy to
* @src: Where to copy from
* @count: The size of the area.
* @n: The size of the area.
*
* Unlike memcpy(), memmove() copes with overlapping areas.
*/
void *(memmove)(void *dest, const void *src, size_t count)
void *(memmove)(void *dest, const void *src, size_t n)
{
char *tmp, *s;
if (dest <= src) {
tmp = (char *) dest;
s = (char *) src;
while (count--)
while (n--)
*tmp++ = *s++;
} else {
tmp = (char *) dest + count;
s = (char *) src + count;
while (count--)
tmp = (char *) dest + n;
s = (char *) src + n;
while (n--)
*--tmp = *--s;
}
+3 -3
View File
@@ -8,15 +8,15 @@
* memset - Fill a region of memory with the given value
* @s: Pointer to the start of the area.
* @c: The byte to fill the area with
* @count: The size of the area.
* @n: The size of the area.
*
* Do not use memset() to access IO space, use memset_io() instead.
*/
void *(memset)(void *s, int c, size_t count)
void *(memset)(void *s, int c, size_t n)
{
char *xs = (char *) s;
while (count--)
while (n--)
*xs++ = c;
return s;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.