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: <86y33579ku.fsf@baylibre.com>
Date:   Fri, 17 May 2019 10:45:53 +0200
From:   Loys Ollivier <lollivier@...libre.com>
To:     Robin Murphy <robin.murphy@....com>,
        Johan Hovold <johan@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>
Cc:     baylibre-upstreaming@...ups.io, linux-kernel@...r.kernel.org,
        Corentin Labbe <clabbe.montjoie@...il.com>,
        linux-mediatek@...ts.infradead.org,
        Colin Ian King <colin.king@...onical.com>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2] gnss: get serial speed from subdrivers

On Thu 16 May 2019 at 19:02, Robin Murphy <robin.murphy@....com> wrote:

>> -/*
>> - * FIXME: need to provide subdriver defaults or separate dt parsing from
>> - * allocation.
>> - */
>>   static int gnss_serial_parse_dt(struct serdev_device *serdev)
>>   {
>>   	struct gnss_serial *gserial = serdev_device_get_drvdata(serdev);
>>   	struct device_node *node = serdev->dev.of_node;
>> -	u32 speed = 4800;
>> +	u32 speed;
>>   
>> -	of_property_read_u32(node, "current-speed", &speed);
>> +	of_property_read_u32(node, "default-speed", &speed);
>>   
>>   	gserial->speed = speed;
>
> Hmm, maybe it's a bit too convoluted for the compiler to warn about, but 
> if a "default-speed" property is not present, gserial->speed will now be 
> assigned an uninitialised value. I don't know what the intent is neither 
> the driver nor the DT provides a value, but you'll either need to bring 
> back the fallback initialisation above or propagate errors from 
> of_property_read_u32().
>
> Robin.
>

Robin,
Good point, thank you for your review. I'll think about it and see about
a fallback scenario.
I would be in favour of propagating the error because default values are
very dependent on the hardware in use.

Best,

Loys

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ