On 2022-11-04 17:03, Herbert Xu wrote:
> On Fri, Oct 28, 2022 at 02:05:31PM -0700, Kees Cook wrote:
> >
> > @@ -163,7 +163,7 @@ static inline void append_data(u32 * const desc, const void *data, int len)
> > {
> > u32 *offset = desc_end(desc);
> >
> > - if (len) /* avoid sparse warning: memcpy with byte count of 0 */
> > + if (data && len) /* avoid sparse warning: memcpy with byte count of 0 */
> > memcpy(offset, data, len);
>
> How about just killing the if clause altogether? I don't see
> any sparse warnings without it. What am I missing?
I think that was fixed in sparse release v0.5.1 [1]. The workaround 'if
(len)' was introduced back in 2011, and the sparse release v0.5.1 was
done in 2017. So it should probably be safe to remove the 'if (len)' or
what do you think?
Cheers,
Anders
[1] https://sparse.docs.kernel.org/en/latest/release-notes/v0.5.1.html