Re: [PATCH RFC] Add FAT_IOCTL_GET_VOLUME_ID

From: OGAWA Hirofumi
Date: Mon Jul 01 2013 - 02:19:39 EST


OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> writes:

>> + case FAT_IOCTL_GET_VOLUME_ID:
>> + id = fat_ioctl_volume_id(inode);
>> + return copy_to_user((unsigned int *)arg, &id, sizeof(id));
>
>> + case FAT_IOCTL_GET_VOLUME_ID:
>> + id = fat_ioctl_volume_id(inode);
>> + return copy_to_user((unsigned int *)arg, &id, sizeof(id));
>
> This pattern seems to from put_user().
>
> Unnecessary cast of 1st arg. And copy_to_user() returns remaining bytes
> when fail (not error code).

Ah, actually, this needs cast, but it is to annotate for sparse. Well,
is there any reason to restrict this only on the directory?

For now, fat_generic_ioctl() looks easier way to do this.
(fat_generic_ioctl() should work for the both of compat code and dir/file)

Thanks.
--
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/