Skip to content

Commit 4bcc6a0

Browse files
committed
Merge remote-tracking branch 'regmap/for-5.7' into regmap-linus
2 parents 9cb1fd0 + 74edd08 commit 4bcc6a0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/base/regmap/regmap-debugfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
227227
if (*ppos < 0 || !count)
228228
return -EINVAL;
229229

230+
if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
231+
count = PAGE_SIZE << (MAX_ORDER - 1);
232+
230233
buf = kmalloc(count, GFP_KERNEL);
231234
if (!buf)
232235
return -ENOMEM;
@@ -371,6 +374,9 @@ static ssize_t regmap_reg_ranges_read_file(struct file *file,
371374
if (*ppos < 0 || !count)
372375
return -EINVAL;
373376

377+
if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
378+
count = PAGE_SIZE << (MAX_ORDER - 1);
379+
374380
buf = kmalloc(count, GFP_KERNEL);
375381
if (!buf)
376382
return -ENOMEM;

0 commit comments

Comments
 (0)