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: <fa686aa40907161548n1658afaei8dce2d893222019c@mail.gmail.com>
Date:	Thu, 16 Jul 2009 16:48:08 -0600
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Wolfgang Denk <wd@...x.de>
Cc:	linuxppc-dev@...abs.org, Kumar Gala <galak@...nel.crashing.org>,
	netdev@...r.kernel.org
Subject: Re: [PATCH 2/2 v2] MPC52xx FEC: be more conservative when setting 
	MII_SPEED register

On Thu, Jul 16, 2009 at 3:42 PM, Wolfgang Denk<wd@...x.de> wrote:
> This patch adds error checking and prevents clobbering unrelated bits
> (reserved bits or the DIS_PREAMBLE bit) when writing the MII_SPEED
> register on MPC52xx systems.
>
> Signed-off-by: Wolfgang Denk <wd@...x.de>
> Cc: Grant Likely <grant.likely@...retlab.ca>
> Cc: Kumar Gala <galak@...nel.crashing.org>
> Cc: <netdev@...r.kernel.org>

Mostly good.  One comment below.  When it's resolved, feel free to add
my acked-by line.  Thanks for getting this done.

> @@ -105,8 +105,23 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of,
>        dev_set_drvdata(dev, bus);
>
>        /* set MII speed */
> -       out_be32(&priv->regs->mii_speed,
> -               ((mpc5xxx_get_bus_frequency(of->node) >> 20) / 5) << 1);
> +       clock = mpc5xxx_get_bus_frequency(of->node);
> +       if (!clock) {
> +               dev_err(&of->dev, "could not determine IPS/IPB clock\n");
> +               goto out_unmap;
> +       }

Just thought of something.  If it cannot find the clock, then wouldn't
it be better to just use the maximum divider and print a warning
instead of bailing completely?  This goes for the other patch as well.

> +
> +       /* scale for a MII clock <= 2.5 MHz */
> +       speed = (clock + 2499999) / 2500000;
> +
> +       /* only 6 bits (25:30) available for MII speed */
> +       if (speed > 0x3F) {
> +               speed = 0x3F;
> +               dev_err(&of->dev, "MII clock (%d Hz) exceeds max (2.5 MHz)\n",
> +                       clock / speed);
> +       }
> +
> +       clrsetbits_be32(&priv->regs->mii_speed, 0x7E, speed << 1);
>
>        err = of_mdiobus_register(bus, np);
>        if (err)
> --
> 1.6.0.6
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ