diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-09-21 15:26:45 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-09-21 15:26:45 +0200 |
commit | ab4bbde809ff7bc964f638d62959ec4272a8729a (patch) | |
tree | 1e3b2b9c1b118f1a0f94335c8e60a14074e843dc | |
parent | ab0b4b575b46d29bf49dc86047dc2964125db722 (diff) | |
parent | 468c9d928a8f38fdfaa61b05e81473cc7c8a6461 (diff) | |
download | linux-stable-ab4bbde809ff7bc964f638d62959ec4272a8729a.tar.gz linux-stable-ab4bbde809ff7bc964f638d62959ec4272a8729a.tar.bz2 linux-stable-ab4bbde809ff7bc964f638d62959ec4272a8729a.zip |
Merge tag 'fpga-for-6.0-final' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga into char-misc-linus
Xu writes:
FPGA Manager changes for 6.0-final
Intel m10 bmc secure update
- Russ's change fixes the memory leak for a sysfs node reading
All patches have been reviewed on the mailing list, and have been in the
last linux-next releases (as part of our for-6.0 branch).
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
* tag 'fpga-for-6.0-final' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga:
fpga: m10bmc-sec: Fix possible memory leak of flash_buf
-rw-r--r-- | drivers/fpga/intel-m10-bmc-sec-update.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/fpga/intel-m10-bmc-sec-update.c b/drivers/fpga/intel-m10-bmc-sec-update.c index 72c677c910de..133e511355c9 100644 --- a/drivers/fpga/intel-m10-bmc-sec-update.c +++ b/drivers/fpga/intel-m10-bmc-sec-update.c @@ -148,10 +148,6 @@ static ssize_t flash_count_show(struct device *dev, stride = regmap_get_reg_stride(sec->m10bmc->regmap); num_bits = FLASH_COUNT_SIZE * 8; - flash_buf = kmalloc(FLASH_COUNT_SIZE, GFP_KERNEL); - if (!flash_buf) - return -ENOMEM; - if (FLASH_COUNT_SIZE % stride) { dev_err(sec->dev, "FLASH_COUNT_SIZE (0x%x) not aligned to stride (0x%x)\n", @@ -160,6 +156,10 @@ static ssize_t flash_count_show(struct device *dev, return -EINVAL; } + flash_buf = kmalloc(FLASH_COUNT_SIZE, GFP_KERNEL); + if (!flash_buf) + return -ENOMEM; + ret = regmap_bulk_read(sec->m10bmc->regmap, STAGING_FLASH_COUNT, flash_buf, FLASH_COUNT_SIZE / stride); if (ret) { |