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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 16 Sep 2019 21:24:26 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     Dan Carpenter <dan.carpenter@...cle.com>,
        Maxime Ripard <mripard@...nel.org>
Cc:     mchehab@...nel.org, linux-media@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] media: v4l: cadence: Fix how unsued lanes are handled in
 'csi2rx_start()'

Le 16/09/2019 à 08:28, Dan Carpenter a écrit :
> On Fri, Sep 13, 2019 at 09:57:09AM +0200, Maxime Ripard wrote:
>> Hi Christophe,
>>
>> On Thu, Sep 12, 2019 at 10:44:50PM +0200, Christophe JAILLET wrote:
>>> The 2nd parameter of 'find_first_zero_bit()' is a number of bits, not of
>>> bytes. So use 'BITS_PER_LONG' instead of 'sizeof(lanes_used)'.
>>>
>>> Fixes: 1fc3b37f34f6 ("media: v4l: cadence: Add Cadence MIPI-CSI2 RX driver")
>>> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
>>> ---
>>> This patch is purely speculative. Using BITS_PER_LONG looks logical to me,
>>> but I'm not 100% sure that it is what is expected here. 'csi2rx->max_lanes'
>>> could also be a good candidate.
>> Yeah, csi2rx->max_lanes would make more sense in that context. Could
>> you resend a new version?
> This is sort of unrelated, but for Smatch purposes the csi2rx->max_lanes
> comes from the firmware in csi2rx_parse_dt() and it could be any u8
> value.

Hi Dan,

not sure to follow you.

csi2rx_probe()
   --> csi2rx_get_resources()
      -->  ...
           dev_cfg = readl(csi2rx->base + CSI2RX_DEVICE_CFG_REG);
           ...
           csi2rx->max_lanes = dev_cfg & 7;
           if (csi2rx->max_lanes > CSI2RX_LANES_MAX) {
              dev_err(&pdev->dev, "Invalid number of lanes: %u\n",
                      csi2rx->max_lanes);
              return -EINVAL;
           }

So I guess, that we can trust max_lanes because of the 'if (... > 
CSI2RX_LANES_MAX)' check.

Did I miss something?


> I sort of wish that people would write code which was known to be
> correct just from reading the kernel code, without looking at the
> firmware...  I guess I could mark v4l2_fwnode_endpoint_parse() as always
> giving us valid data, but that still wouldn't tell us what the valid
> data is.  It's hard to know the right answer from a static analysis
> point of view.
>
> regards,
> dan carpenter
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ