Skip to content

Commit 9dfec4a

Browse files
ea1davisgregkh
authored andcommitted
USB: core: remove the move buf action
The buffer size of sysfs is fixed at PAGE_SIZE, and the page offset of the buf parameter of sysfs_emit_at() must be 0, there is no need to manually manage the buf pointer offset. Fixes: 711d41a ("usb: core: Use sysfs_emit_at() when showing dynamic IDs") Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=b6445765657b5855e869 Tested-by: [email protected] Signed-off-by: Edward Adam Davis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7609fb6 commit 9dfec4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/core/driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ ssize_t usb_show_dynids(struct usb_dynids *dynids, char *buf)
119119
guard(mutex)(&usb_dynids_lock);
120120
list_for_each_entry(dynid, &dynids->list, node)
121121
if (dynid->id.bInterfaceClass != 0)
122-
count += sysfs_emit_at(&buf[count], count, "%04x %04x %02x\n",
122+
count += sysfs_emit_at(buf, count, "%04x %04x %02x\n",
123123
dynid->id.idVendor, dynid->id.idProduct,
124124
dynid->id.bInterfaceClass);
125125
else
126-
count += sysfs_emit_at(&buf[count], count, "%04x %04x\n",
126+
count += sysfs_emit_at(buf, count, "%04x %04x\n",
127127
dynid->id.idVendor, dynid->id.idProduct);
128128
return count;
129129
}

0 commit comments

Comments
 (0)