···584584585585static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)586586{587587- struct uhci_debug *up;588588- loff_t new = -1;589589-590590- up = file->private_data;591591-592592- /*593593- * XXX: atomic 64bit seek access, but that needs to be fixed in the VFS594594- */595595- switch (whence) {596596- case 0:597597- new = off;598598- break;599599- case 1:600600- new = file->f_pos + off;601601- break;602602- }603603-604604- if (new < 0 || new > up->size)605605- return -EINVAL;606606-607607- return (file->f_pos = new);587587+ struct uhci_debug *up = file->private_data;588588+ return no_seek_end_llseek_size(file, off, whence, up->size);608589}609590610591static ssize_t uhci_debug_read(struct file *file, char __user *buf,
+1-15
drivers/usb/misc/sisusbvga/sisusb.c
···28252825 return -ENODEV;28262826 }2827282728282828- switch (orig) {28292829- case 0:28302830- file->f_pos = offset;28312831- ret = file->f_pos;28322832- /* never negative, no force_successful_syscall needed */28332833- break;28342834- case 1:28352835- file->f_pos += offset;28362836- ret = file->f_pos;28372837- /* never negative, no force_successful_syscall needed */28382838- break;28392839- default:28402840- /* seeking relative to "end of file" is not supported */28412841- ret = -EINVAL;28422842- }28282828+ ret = no_seek_end_llseek(file, offset, orig);2843282928442830 mutex_unlock(&sisusb->lock);28452831 return ret;
+39
fs/read_write.c
···171171EXPORT_SYMBOL(fixed_size_llseek);172172173173/**174174+ * no_seek_end_llseek - llseek implementation for fixed-sized devices175175+ * @file: file structure to seek on176176+ * @offset: file offset to seek to177177+ * @whence: type of seek178178+ *179179+ */180180+loff_t no_seek_end_llseek(struct file *file, loff_t offset, int whence)181181+{182182+ switch (whence) {183183+ case SEEK_SET: case SEEK_CUR:184184+ return generic_file_llseek_size(file, offset, whence,185185+ ~0ULL, 0);186186+ default:187187+ return -EINVAL;188188+ }189189+}190190+EXPORT_SYMBOL(no_seek_end_llseek);191191+192192+/**193193+ * no_seek_end_llseek_size - llseek implementation for fixed-sized devices194194+ * @file: file structure to seek on195195+ * @offset: file offset to seek to196196+ * @whence: type of seek197197+ * @size: maximal offset allowed198198+ *199199+ */200200+loff_t no_seek_end_llseek_size(struct file *file, loff_t offset, int whence, loff_t size)201201+{202202+ switch (whence) {203203+ case SEEK_SET: case SEEK_CUR:204204+ return generic_file_llseek_size(file, offset, whence,205205+ size, 0);206206+ default:207207+ return -EINVAL;208208+ }209209+}210210+EXPORT_SYMBOL(no_seek_end_llseek_size);211211+212212+/**174213 * noop_llseek - No Operation Performed llseek implementation175214 * @file: file structure to seek on176215 * @offset: file offset to seek to