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] [day] [month] [year] [list]
Message-ID: <ec3de20e-92cc-4e22-a30f-a9f57588278c@web.de>
Date: Wed, 18 Sep 2024 16:32:29 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Nicolas Ferre <nicolas.ferre@...rochip.com>, linux-clk@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org,
 Alexandre Belloni <alexandre.belloni@...tlin.com>,
 Claudiu Beznea <claudiu.beznea@...on.dev>,
 Michael Turquette <mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] clk: at91: pmc: Use common error handling code in
 pmc_register_ops()

>> Add a jump target so that a bit of exception handling can be better reused
>> at the end of this function implementation.
…
> Bad track record and no real benefit from the patch:
> NACK, sorry.
…
>> +++ b/drivers/clk/at91/pmc.c
>> @@ -162,20 +162,18 @@ static int __init pmc_register_ops(void)
>>          if (!np)
>>                  return -ENODEV;
>>
>> -       if (!of_device_is_available(np)) {
>> -               of_node_put(np);
>> -               return -ENODEV;
>> -       }
>> +       if (!of_device_is_available(np))
>> +               goto put_node;
>> +
>>          of_node_put(np);
>>
>>          np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-securam");
>>          if (!np)
>>                  return -ENODEV;
>>
>> -       if (!of_device_is_available(np)) {
>> -               of_node_put(np);
>> -               return -ENODEV;
>> -       }
>> +       if (!of_device_is_available(np))
>> +               goto put_node;
>> +
>>          of_node_put(np);
>>
>>          at91_pmc_backup_suspend = of_iomap(np, 0);
>> @@ -187,6 +185,10 @@ static int __init pmc_register_ops(void)
>>          register_syscore_ops(&pmc_syscore_ops);
>>
>>          return 0;
>> +
>> +put_node:
>> +       of_node_put(np);
>> +       return -ENODEV;
>>   }
…

* Do you really disagree to advice from related information sources?
  https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources?

* How do you think about to increase the application of scope-based resource management?


Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ