mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 20:22:08 +02:00
regmap: qti-regmap-debugfs: use kzalloc() for read buffer allocation
Change the kmalloc() call in regmap_read_debugfs() to kzalloc() to avoid a corner case in which copy_to_user() could be called with the contents of the 'buf' array unallocated. Change-Id: I9899ff01e8482f68d72247466ecf8615b1d0d35f Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
parent
99b3d7a114
commit
ffa4280183
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
|
|
@ -289,7 +289,7 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
|
|||
if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
|
||||
count = PAGE_SIZE << (MAX_ORDER - 1);
|
||||
|
||||
buf = kmalloc(count, GFP_KERNEL);
|
||||
buf = kzalloc(count, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user