[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b1bae333-fe86-2c48-b872-fb72ebe2d53e@linux.com>
Date: Wed, 22 Apr 2020 11:32:40 +0300
From: Denis Efremov <efremov@...ux.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Willy Tarreau <w@....eu>, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] floppy: suppress UBSAN warning in setup_rw_floppy()
On 4/22/20 11:24 AM, Christoph Hellwig wrote:
>
> I don't think we can just change FD_RAW_CMD_SIZE or cmd as that could
> break userspace.
The second patch adds these defines FD_RAW_CMD_SIZE, FD_RAW_REPLY_SIZE.
Currently they are not in the uapi. Ok, I will send v2.
But otherwise, yes something very much like that:
>
>> #define FD_RAW_CMD_SIZE 16
>> #define FD_RAW_REPLY_SIZE 16
>> +#define FD_RAW_FULL_CMD_SIZE (FD_RAW_CMD_SIZE + 1 + FD_RAW_CMD_SIZE)
>>
>> unsigned char cmd_count;
>> - unsigned char cmd[FD_RAW_CMD_SIZE];
>> - unsigned char reply_count;
>> - unsigned char reply[FD_RAW_REPLY_SIZE];
>> + union {
>> + struct {
>> + unsigned char cmd[FD_RAW_CMD_SIZE];
>> + unsigned char reply_count;
>> + unsigned char reply[FD_RAW_REPLY_SIZE];
>> + };
>> + unsigned char full_cmd[FD_RAW_FULL_CMD_SIZE];
>> + };
>
>> int track;
>>
>> Denis
> ---end quoted text---
>
Powered by blists - more mailing lists