From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAA07C54FCF for ; Sun, 22 Mar 2020 11:10:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 804DF20774 for ; Sun, 22 Mar 2020 11:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584875455; bh=F+bb/PhDrGL6xSqYVlRBI18Yhx3UabZn2G7TvUh7EF4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=oBAwMEuHowPFh5o69WC/iYIay4gDyo2fM0T3Z7SI9u3sv1sQm4JlTdvWBFRYtLRcO z8rIC8C3yeLMUIBJe62RAWvICpL9w57BqwMxC0iVv/+ryZ7QaLINtIuVntzdpiKKlc u1fhhnOP+CceBaJYbb8DgWBAfRSMF2qnjP6OcZEE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727026AbgCVLKy (ORCPT ); Sun, 22 Mar 2020 07:10:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:52676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726866AbgCVLKy (ORCPT ); Sun, 22 Mar 2020 07:10:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7384520753; Sun, 22 Mar 2020 11:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584875454; bh=F+bb/PhDrGL6xSqYVlRBI18Yhx3UabZn2G7TvUh7EF4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jGWHc9YL5uj95BAw1iYQ3bd8gW+k+tBYGLfGEc/MOZ3necAF2Yqz4LxDye3nuh6Da 3jrs1YfWP9wNIc9v2ikSqgtxxdTdqNPxOmmsZBCNOhWzIuxsjs6MXFEl07LrIdUC4K X8+cBWpxTZesIu/s4EQyz4id44lg495ySHcd4CUw= Date: Sun, 22 Mar 2020 12:10:51 +0100 From: Greg KH To: Tobias Waldekranz Cc: davem@davemloft.net, netdev@vger.kernel.org, andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, linux-usb@vger.kernel.org Subject: Re: [PATCH v3 2/2] net: phy: add marvell usb to mdio controller Message-ID: <20200322111051.GB72939@kroah.com> References: <20200322074006.GB64528@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sun, Mar 22, 2020 at 10:09:28AM +0100, Tobias Waldekranz wrote: > 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 Ok, just wanted to make sure :) Reviewed-by: Greg Kroah-Hartman