On 17/04/2024 8:14 am, Roger Pau Monné wrote: > On Tue, Apr 16, 2024 at 04:52:51PM +0100, Andrew Cooper wrote: >> Misra Rule 21.16 doesn't like the use of memcmp() between a string literal >> and >> a UINT8 array. Rewrite using plain compares. > The commit message makes it look like it's a type mismatch issue > between the two elements being compared, but from my reading of the > rule the issue is with the usage of a char pointer with memcmp(). > IOW: even if the two parameters are char pointers it would still be a > violation. > > "Misra Rule 21.16 forbids the use of memcmp() against character > arrays. Rewrite using plain compares since checking for "PE\0\0" > cannot be done using strncmp()."
I've tweaked the sentence to say character array, but IMO it's really not about strncmp() which wouldn't be correct to use here even if it happened to produce a correct answer. >> No functional change. >> >> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> > LGTM (possibly pending the adjustment of the commit message): > > Acked-by: Roger Pau Monné <roger....@citrix.com> Thanks.