lkml.org 
[lkml]   [2021]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] base: dd: fix error return code of driver_sysfs_add()
From
Date


On 2021/3/23 21:57, Greg KH wrote:
> On Fri, Mar 05, 2021 at 02:24:05AM -0800, Jia-Ju Bai wrote:
>> When device_create_file() fails and returns a non-zero value,
>> no error return code of driver_sysfs_add() is assigned.
>> To fix this bug, ret is assigned with the return value of
>> device_create_file(), and then ret is checked.
>>
>> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
>> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
>> ---
>> drivers/base/dd.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
>> index 9179825ff646..f94bbef95258 100644
>> --- a/drivers/base/dd.c
>> +++ b/drivers/base/dd.c
>> @@ -413,8 +413,11 @@ static int driver_sysfs_add(struct device *dev)
>> if (ret)
>> goto rm_dev;
>>
>> - if (!IS_ENABLED(CONFIG_DEV_COREDUMP) || !dev->driver->coredump ||
>> - !device_create_file(dev, &dev_attr_coredump))
>> + if (!IS_ENABLED(CONFIG_DEV_COREDUMP) || !dev->driver->coredump)
>> + return 0;
>> +
> Trailing whitespace :

Ah, sorry, I will send a V2 patch.


Best wishes,
Jia-Ju Bai

\
 
 \ /
  Last update: 2021-03-24 03:35    [W:0.068 / U:1.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site