Skip to content

Commit

Permalink
uml: use correct type in BLKGETSIZE ioctl
Browse files Browse the repository at this point in the history
I found a type mismatch in UML that makes host block devices unusable as ubd
devices on x86_64 and other 64 bits systems (segfault of the mm subsystem):

In block/ioctl.c, the following lines show that the BLKGETSIZE ioctl expects
a pointer to a long:

	case BLKGETSIZE:
		if ((bdev->bd_inode->i_size >> 9) > ~0UL)
			return -EFBIG;
		return put_ulong(arg, bdev->bd_inode->i_size >> 9);

In arch/um/os-Linux/file.c, os_file_size calls it with an int.

The ioctl_list man page should be fixed as well.

Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Nicolas George authored and Linus Torvalds committed Sep 19, 2007
1 parent 3558c9b commit 2c392a4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/um/os-Linux/file.c
Expand Up @@ -320,7 +320,8 @@ int os_file_size(char *file, unsigned long long *size_out)
}

if(S_ISBLK(buf.ust_mode)){
int fd, blocks;
int fd;
long blocks;

fd = os_open_file(file, of_read(OPENFLAGS()), 0);
if(fd < 0){
Expand Down

0 comments on commit 2c392a4

Please sign in to comment.