Skip to content

Commit ab4bbde

Browse files
committed
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
2 parents ab0b4b5 + 468c9d9 commit ab4bbde

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/fpga/intel-m10-bmc-sec-update.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ static ssize_t flash_count_show(struct device *dev,
148148
stride = regmap_get_reg_stride(sec->m10bmc->regmap);
149149
num_bits = FLASH_COUNT_SIZE * 8;
150150

151-
flash_buf = kmalloc(FLASH_COUNT_SIZE, GFP_KERNEL);
152-
if (!flash_buf)
153-
return -ENOMEM;
154-
155151
if (FLASH_COUNT_SIZE % stride) {
156152
dev_err(sec->dev,
157153
"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,
160156
return -EINVAL;
161157
}
162158

159+
flash_buf = kmalloc(FLASH_COUNT_SIZE, GFP_KERNEL);
160+
if (!flash_buf)
161+
return -ENOMEM;
162+
163163
ret = regmap_bulk_read(sec->m10bmc->regmap, STAGING_FLASH_COUNT,
164164
flash_buf, FLASH_COUNT_SIZE / stride);
165165
if (ret) {

0 commit comments

Comments
 (0)