lkml.org 
[lkml]   [2023]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: pi433: modify bit_rate from u16 to u32
On Thu, Feb 02, 2023 at 10:02:25PM +0000, David Laight wrote:
> From: Dan Carpenter
> > Sent: 01 February 2023 13:23
> >
> > On Wed, Feb 01, 2023 at 12:34:50PM +0000, David Laight wrote:
> > > In reality having a uapi structure with embedded padding should
> > > be banned.
> > > But that would need a compiler attribute to enforce it.
> >
> > It would be simple enough to grep the names of all the UAPI struct and
> > use pahole to make a list of the existing structs which have holes.
> > Then re-run the script every week and complain when new holey struct
> > types are added.
> >
> > You could do a similar thing with Smatch looking at copy_to/from_user()
> > struct types.
>
> Would it be possible to add aa attribute and check to sparse?
>
> Might persuade people to use it instead of 'packed' for structures
> that map defined byte layouts and so mustn't be holey - but are
> never actually misaligned in memory.

I mean, it's kind of a before and after thing where we have to allow
all the existing code and complain about new code. But yeah, we could
use the __user annotation as well. If we encountered a
`struct oldabi_stat64 __user *statbuf` then complain if oldabi_stat64
had a hole. At the end, delete all the warnings that existed in the
previously tested kernel.

regards,
dan carpenter

\
 
 \ /
  Last update: 2023-03-27 00:08    [W:0.102 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site