From: Joe Perches Date: Wed, 10 Mar 2010 23:21:10 +0000 (-0800) Subject: drivers/block/floppy.c: remove misleading, used once FD_IOCTL_ALLOWED macro X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0aad92cfea6fec14bd57dd9c283cc6eb023c97bd;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git drivers/block/floppy.c: remove misleading, used once FD_IOCTL_ALLOWED macro Just code the test directly Signed-off-by: Joe Perches Cc: Stephen Hemminger Cc: Jens Axboe Cc: Marcin Slusarz Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 0b659bb02ad4..67e8e5f366c5 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3420,8 +3420,6 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo) static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long param) { -#define FD_IOCTL_ALLOWED (mode & (FMODE_WRITE|FMODE_WRITE_IOCTL)) - int drive = (long)bdev->bd_disk->private_data; int type = ITYPE(UDRS->fd_device); int i; @@ -3454,7 +3452,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, return ret; /* permission checks */ - if (((cmd & 0x40) && !FD_IOCTL_ALLOWED) || + if (((cmd & 0x40) && !(mode & (FMODE_WRITE | FMODE_WRITE_IOCTL))) || ((cmd & 0x80) && !capable(CAP_SYS_ADMIN))) return -EPERM;