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: <C1H8VLGMUEEC.3BCHVI0HO90KD@wkz-x280>
Date:   Sun, 22 Mar 2020 10:09:28 +0100
From:   "Tobias Waldekranz" <tobias@...dekranz.com>
To:     "Greg KH" <gregkh@...uxfoundation.org>
Cc:     <davem@...emloft.net>, <netdev@...r.kernel.org>, <andrew@...n.ch>,
        <f.fainelli@...il.com>, <hkallweit1@...il.com>,
        <linux-usb@...r.kernel.org>
Subject: Re: [PATCH v3 2/2] net: phy: add marvell usb to mdio controller

On Sun Mar 22, 2020 at 8:40 AM, Greg KH wrote:
> From a USB point of view, it looks sane, only one question:

Great, thanks for the review.

> > +static int mvusb_mdio_probe(struct usb_interface *interface,
> > +			    const struct usb_device_id *id)
> > +{
> > +	struct device *dev = &interface->dev;
> > +	struct mvusb_mdio *mvusb;
> > +	struct mii_bus *mdio;
> > +
> > +	mdio = devm_mdiobus_alloc_size(dev, sizeof(*mvusb));
>
> 
> You allocate a bigger buffer here than the original pointer thinks it is
> pointing to?

Yes. I've seen this pattern in a couple of places in the kernel,
e.g. alloc_netdev also does this. The object is extended with the
requested size, and the offset is stored somewhere for later use by
the driver.

> > +	if (!mdio)
> > +		return -ENOMEM;
> > +
> > +	mvusb = mdio->priv;
>
> 
> And then you set this pointer here?

...in this case in the priv member.

https://code.woboq.org/linux/linux/drivers/net/phy/mdio_bus.c.html#143

Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ