lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb13fc84-d1e8-4121-8569-cf405a35e721@wanadoo.fr>
Date:   Sun, 3 Dec 2023 11:36:00 +0100
From:   Marion & Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     Su Hui <suhui@...china.com>, dan.carpenter@...aro.org,
        hare@...e.com, jejb@...ux.ibm.com, martin.petersen@...cle.com
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH v2 3/3] scsi: aic7xxx: return negative error codes in
 aic7770_probe()



Le 03/12/2023 à 11:34, Christophe JAILLET a écrit :
> Le 01/12/2023 à 03:59, Su Hui a écrit :
>> aic7770_config() returns both negative and positive error code.
>> it's better to make aic7770_probe() only return negative error codes.
>>
>> And the previous patch made ahc_linux_register_host() return negative 
>> error
>> codes, which makes sure aic7770_probe() returns negative error codes.
>>
>> Signed-off-by: Su Hui <suhui@...china.com>
>> ---
>>   drivers/scsi/aic7xxx/aic7770_osm.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c 
>> b/drivers/scsi/aic7xxx/aic7770_osm.c
>> index bdd177e3d762..a19cdd87c453 100644
>> --- a/drivers/scsi/aic7xxx/aic7770_osm.c
>> +++ b/drivers/scsi/aic7xxx/aic7770_osm.c
>> @@ -87,17 +87,17 @@ aic7770_probe(struct device *dev)
>>       sprintf(buf, "ahc_eisa:%d", eisaBase >> 12);
>>       name = kstrdup(buf, GFP_ATOMIC);
>>       if (name == NULL)
>> -        return (ENOMEM);
>> +        return -ENOMEM;
>>       ahc = ahc_alloc(&aic7xxx_driver_template, name);
>>       if (ahc == NULL)
> 
> Unrelated to your fix, but 'name' is leaking here.

Oups, no, ahc_alloc() handles it.
Really strange API!

CJ

> 
> Also, kasprintf() could be used to avoid buf+sprintf()+kstrdup()
> 
> The GFP_ATOMIC in the allocation could certainly also be just a GFP_KERNEL.
> 
> CJ
> 
>> -        return (ENOMEM);
>> +        return -ENOMEM;
>>       ahc->dev = dev;
>>       error = aic7770_config(ahc, aic7770_ident_table + 
>> edev->id.driver_data,
>>                      eisaBase);
>>       if (error != 0) {
>>           ahc->bsh.ioport = 0;
>>           ahc_free(ahc);
>> -        return (error);
>> +        return error < 0 ? error : -error;
>>       }
>>        dev_set_drvdata(dev, ahc);
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ