Re: 回复: linux-next: build failure after merge of the char-misc tree
From: Greg KH
Date: Thu Jul 03 2025 - 05:29:17 EST
On Thu, Jul 03, 2025 at 08:55:31AM +0000, Xu, Lizhi wrote:
> Greg,
>
> In ctx_fire_notification(), the following code can fully prove that the header is followed by the payload.
> ev.msg.hdr.payload_size = sizeof(ev) - sizeof(ev.msg.hdr);
>
> I sent a second version of the patch, did you notice it? It can solve the problem reported by Stephen Rothwell.
>
> V2 Patch: https://lore.kernel.org/all/20250703075334.856445-1-lizhi.xu@xxxxxxxxxxxxx
I see that now, thank you.
But, if I had not reverted your previous one, that patch would not have
applied :(
Also, how can you "guarantee" that there is no padding between those
structure fields so that your "pointer math" is correct here? Why not
fix this up properly to use the correct way to define that you have a
"payload" at the end of a structure, AND properly define how large that
payload is with the specific variable that describes that? By doing
that, then the compiler can check when things violate those rules going
forward.
thanks,
greg k-h