Re: [PATCH v3] arch/microblaze: add support for get_user() of size 8 bytes
From: Randy Dunlap
Date: Sun Sep 01 2019 - 22:10:18 EST
On 9/1/19 12:10 PM, Randy Dunlap wrote:
> On 9/1/19 10:31 AM, Linus Torvalds wrote:
>> On Sun, Sep 1, 2019 at 10:07 AM Linus Torvalds
>> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>>>
>>> I guess I'll apply it. I'm not sure why you _care_ about microblaze, but ...
>
> It was just a response to the 0day build bot reporting build errors.
>
>
>> Ugh. As I was going to apply it, my code cleanliness conscience struck.
>>
>> I can't deal with that unnecessary duplication of code. Does something
>> like the attached patch work instead?
>>
>> Totally untested, but looks much cleaner.
>
> Hm, I'm getting one (confusing) build error, in block/scsi_ioctl.c:
>
> CC block/scsi_ioctl.o
> In file included from ../include/linux/uaccess.h:11,
> from ../include/linux/highmem.h:9,
> from ../include/linux/pagemap.h:11,
> from ../include/linux/blkdev.h:16,
> from ../block/scsi_ioctl.c:9:
> ../block/scsi_ioctl.c: In function 'sg_scsi_ioctl':
> ../arch/microblaze/include/asm/uaccess.h:167:25: error: invalid initializer
> typeof(ptr) __gu_ptr = (ptr); \
> ^
> ../block/scsi_ioctl.c:426:6: note: in expansion of macro 'get_user'
> if (get_user(opcode, sic->data))
> ^~~~~~~~
if (get_user(opcode, sic->data))
return -EFAULT;
where sic->data is unsigned char data[0] here:
typedef struct scsi_ioctl_command {
unsigned int inlen;
unsigned int outlen;
unsigned char data[0];
} Scsi_Ioctl_Command;
On x86_64 this builds as a call to get_user_1().
(cannot do objdump on arch/microblaze/, unknown arch/machine)
I guess we need a way to coerce that to call get_user_1(),
such as a typecast. This _seems_ to work (i.e., call get_user_1()):
if (get_user(opcode, (unsigned char *)(sic->data)))
return -EFAULT;
??
--
~Randy