Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions block/early-lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,11 @@ static int __init devt_from_devname(const char *name, dev_t *devt)
int part;
char s[32];
char *p;
size_t name_len = strnlen(name, sizeof(s));

if (strlen(name) > 31)
if (name_len == sizeof(s))
return -EINVAL;
strcpy(s, name);
memcpy(s, name, name_len + 1);
for (p = s; *p; p++) {
if (*p == '/')
*p = '!';
Expand Down