[dpdk-dev] [PATCH 09/18] drivers: net: qede: fix strncpy constant and NUL
Shaikh, Shahed
Shahed.Shaikh at cavium.com
Wed May 9 01:33:25 CEST 2018
> >>> I think you can retain OSAL_STRNCPY and just replace 30 with
> >> 'bit_name[sizeof(bit_name) - 1' and then set last byte with '\0' just like you
> did.
> >>
> >> Can that actually be fixed inside OSAL_STRNCPY itself, rather than
> >> having each use needing to explicitly null-terminate?
> >
> > Although there is only instance of OSAL_STRNCPY, it makes sense to modify it.
>
> Doesn't it make more sense to get rid of OSAL_* that bring nothing at all to the
> party?
>
> #define OSAL_SPRINTF(name, pattern, ...) \
> sprintf(name, pattern, ##__VA_ARGS__) #define OSAL_SNPRINTF(buf, size,
> format, ...) \
> snprintf(buf, size, format, ##__VA_ARGS__) #define OSAL_STRLEN(string)
> strlen(string) #define OSAL_STRCPY(dst, string) strcpy(dst, string) #define
> OSAL_STRNCPY(dst, string, len) strncpy(dst, string, len) #define
> OSAL_STRCMP(str1, str2) strcmp(str1, str2)
>
> Do I miss the point or these are just cruft?
Hi Andy,
I'll send a cleanup patch for this. For now, you can go ahead with original patch.
Thanks,
Shahed
Acked-by: Shahed Shaikh <shahed.shaikh at cavium.com>
>
> -Andy
>
> > Thanks,
> > Shahed
> >
More information about the dev
mailing list