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]
Date:   Mon, 6 Sep 2021 10:53:41 +0300
From:   Sakari Ailus <sakari.ailus@....fi>
To:     Pavel Machek <pavel@....cz>
Cc:     Martin Kepplinger <martin.kepplinger@...i.sm>,
        devicetree@...r.kernel.org, kernel@...i.sm,
        krzysztof.kozlowski@...onical.com,
        laurent.pinchart@...asonboard.com, linux-kernel@...r.kernel.org,
        linux-media@...r.kernel.org, mchehab@...nel.org,
        paul.kocialkowski@...tlin.com, phone-devel@...r.kernel.org,
        robh@...nel.org, shawnx.tu@...el.com
Subject: Re: [PATCH v8 3/4] media: i2c: add driver for the SK Hynix Hi-846 8M
 pixel camera

Hi Pavel, Martin,

On Fri, Sep 03, 2021 at 06:17:43PM +0200, Pavel Machek wrote:
> > +static void hi846_write_reg_16(struct hi846 *hi846, u16 reg, u16 val, int *err)
> > +{
> > +	struct i2c_client *client = v4l2_get_subdevdata(&hi846->sd);
> > +	u8 buf[6];
> > +	int ret;
> > +
> > +	if (*err < 0)
> > +		return;
> > +
> > +	put_unaligned_be16(reg, buf);
> > +	put_unaligned_be32(val << 8 * 2, buf + 2);
> 
> Is that obfuscated way of saying put_unaligned_be16(val, buf+2); buf[3] = 0; buf[4] = 0; ?

Good catch.

The buf should be only four u8's long, and you should use 16-bit variant
here, too.

Also the transfer should be done on sizeof(buf), not 4 (which indeed is the
same, but cleaner).

-- 
Regards,

Sakari Ailus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ