On 07/01/2019 10:39, Jan Beulich wrote: > The pre-decrement would not only cause misbehavior when wrapping (benign > because there shouldn't be any NULL pointers passed in), but may also > create a pointer pointing outside the object that the passed in pointer > points to (it won't be de-referenced though). Use post-decrement (and > > instead of >= ) instead.
This commit message doesn't match the patch. There is no post-decrement and '>' involved. With that fixed you can add: Reviewed-by: Juergen Gross <[email protected]> Juergen > > Take the opportunity and also > - convert bogus space (partly 7 of them) indentation to Linux style tab > one, > - add two blank lines. > > Signed-off-by: Jan Beulich <[email protected]> > > --- a/xen/common/string.c > +++ b/xen/common/string.c > @@ -174,12 +174,13 @@ char *(strchr)(const char *s, int c) > */ > char *(strrchr)(const char *s, int c) > { > - const char *p = s + strlen(s); > - do { > - if (*p == (char)c) > - return (char *)p; > - } while (--p >= s); > - return NULL; > + const char *p = s + strlen(s); > + > + for (; *p != (char)c; --p) > + if (p == s) > + return NULL; > + > + return (char *)p; > } > #endif > > > > > > > _______________________________________________ > Xen-devel mailing list > [email protected] > https://lists.xenproject.org/mailman/listinfo/xen-devel > _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
