gadget/f_mass_storage: stop messing with the address limit

Instead use kernel_read/write consistently, which also makes sparse
happy.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Christoph Hellwig and committed by
Al Viro
05a4a33b 21cb2559

+6 -15
+6 -15
drivers/usb/gadget/function/f_mass_storage.c
··· 686 686 687 687 /* Perform the read */ 688 688 file_offset_tmp = file_offset; 689 - nread = vfs_read(curlun->filp, 690 - (char __user *)bh->buf, 691 - amount, &file_offset_tmp); 689 + nread = kernel_read(curlun->filp, bh->buf, amount, 690 + &file_offset_tmp); 692 691 VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, 693 692 (unsigned long long)file_offset, (int)nread); 694 693 if (signal_pending(current)) ··· 882 883 883 884 /* Perform the write */ 884 885 file_offset_tmp = file_offset; 885 - nwritten = vfs_write(curlun->filp, (char __user *)bh->buf, 886 - amount, &file_offset_tmp); 886 + nwritten = kernel_write(curlun->filp, bh->buf, amount, 887 + &file_offset_tmp); 887 888 VLDBG(curlun, "file write %u @ %llu -> %d\n", amount, 888 889 (unsigned long long)file_offset, (int)nwritten); 889 890 if (signal_pending(current)) ··· 1020 1021 1021 1022 /* Perform the read */ 1022 1023 file_offset_tmp = file_offset; 1023 - nread = vfs_read(curlun->filp, 1024 - (char __user *) bh->buf, 1025 - amount, &file_offset_tmp); 1024 + nread = kernel_read(curlun->filp, bh->buf, amount, 1025 + &file_offset_tmp); 1026 1026 VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, 1027 1027 (unsigned long long) file_offset, 1028 1028 (int) nread); ··· 2450 2452 2451 2453 /* Allow the thread to be frozen */ 2452 2454 set_freezable(); 2453 - 2454 - /* 2455 - * Arrange for userspace references to be interpreted as kernel 2456 - * pointers. That way we can pass a kernel pointer to a routine 2457 - * that expects a __user pointer and it will work okay. 2458 - */ 2459 - set_fs(get_ds()); 2460 2455 2461 2456 /* The main loop */ 2462 2457 while (common->state != FSG_STATE_TERMINATED) {