[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5057964.QyIB3GKfsB@wuerfel>
Date: Mon, 19 Oct 2015 15:19:25 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Paul Osmialowski <p.osmialowsk@...sung.com>
Cc: Jonathan Corbet <corbet@....net>,
Andrew Morton <akpm@...ux-foundation.org>,
Petr Mladek <pmladek@...e.cz>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Daniel Mack <daniel@...que.org>,
Kay Sievers <kay.sievers@...y.org>,
Joe Perches <joe@...ches.com>, Tejun Heo <tj@...nel.org>,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
linux-api@...r.kernel.org,
Marcin Niesluchowski <m.niesluchow@...sung.com>,
Karol Lewandowski <k.lewandowsk@...sung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Shuah Khan <shuahkh@....samsung.com>
Subject: Re: [RFC v3 6/9] kmsg: add ioctl for adding and deleting kmsg* devices
On Monday 19 October 2015 14:58:20 Paul Osmialowski wrote:
> +
> +struct kmsg_cmd_buffer_add {
> + size_t size;
> + unsigned short mode;
> + int minor;
> +} __attribute__((packed));
> +
> +#define KMSG_IOCTL_MAGIC 0xBB
> +
> +/*
>
Try to avoid using packed unaligned data structures. Here I would
just use __u64 and __u32 members.
> + case KMSG_CMD_BUFFER_ADD:
> + if (copy_from_user(&size, argp, sizeof(size)))
> + return -EFAULT;
> + argp += sizeof(size);
> + if (copy_from_user(&mode, argp, sizeof(mode)))
> + return -EFAULT;
This is a rather unusual way to access the data. Just copy the
entire structure to the stack.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists