Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1402423

Re: [PATCH v7 1/3] create SMAF module

From Daniel Vetter <daniel@ffwll.ch>
Newsgroups linux.kernel
Subject Re: [PATCH v7 1/3] create SMAF module
Date 2016-05-17 17:50 +0200
Message-ID <rzPpU-6oq-5@gated-at.bofh.it> (permalink)
References <rwUYN-87h-17@gated-at.bofh.it> <rwUYO-87h-29@gated-at.bofh.it> <rzzEu-4H3-9@gated-at.bofh.it> <rzNHw-5fA-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, May 17, 2016 at 03:50:41PM +0200, Benjamin Gaignard wrote:
> 2016-05-17 0:58 GMT+02:00 Emil Velikov <emil.l.velikov@gmail.com>:
> > On 9 May 2016 at 16:07, Benjamin Gaignard <benjamin.gaignard@linaro.org> wrote:
> >> + * @fd:                returned file descriptor
> >> + */
> >> +struct smaf_create_data {
> >> +       size_t length;
> >> +       unsigned int flags;
> >> +       char name[ALLOCATOR_NAME_LENGTH];
> >> +       int fd;
> > The structs here feels quite fragile. Please read up on Daniel
> > Vetter's "Botching up ioctls" [1]. Personally I find pahole quite
> > useful is such process.
> >
> if I describe the structures like this:
> /**
>  * struct smaf_create_data - allocation parameters
>  * @length: size of the allocation
>  * @flags: flags passed to allocator
>  * @name_len: length of name
>  * @name: name of the allocator to be selected, could be NULL
>  * @fd: returned file descriptor
>  */
> struct smaf_create_data {
> size_t length;
> unsigned int flags;
> size_t name_len;
> char __user *name;
> int fd;
> char padding[44];
> };
> 
> does it sound more robust for you ?
> 
> > Hopefully I haven't lost the plot with the above, if I had don't be
> > shy to point out.
> >
> > Thanks,
> > Emil
> >
> > [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/ioctl/botching-up-ioctls.txt

Please read this doc in it's entirety, ask on irc if you don't get certain
parts. Then come back an rework your patch.

Super short summary: _All_ the types you've used are absolute no-go in
ioctl structs.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v7 1/3] create SMAF module Emil Velikov <emil.l.velikov@gmail.com> - 2016-05-17 01:00 +0200
  Re: [PATCH v7 1/3] create SMAF module Benjamin Gaignard <benjamin.gaignard@linaro.org> - 2016-05-17 16:00 +0200
    Re: [PATCH v7 1/3] create SMAF module Daniel Vetter <daniel@ffwll.ch> - 2016-05-17 17:50 +0200
    Re: [PATCH v7 1/3] create SMAF module Emil Velikov <emil.l.velikov@gmail.com> - 2016-05-17 21:10 +0200
      Re: [PATCH v7 1/3] create SMAF module Emil Velikov <emil.l.velikov@gmail.com> - 2016-05-17 23:40 +0200
      Re: [PATCH v7 1/3] create SMAF module Daniel Vetter <daniel@ffwll.ch> - 2016-05-17 23:40 +0200

csiph-web