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
| ||
|
Date: Sat, 04 Apr 2015 20:10:09 +0300 From: Pavel Nakonechny <pavel.nakonechny@...tlab.ru> To: Andrew Lunn <andrew@...n.ch> Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Grant Likely <grant.likely@...aro.org>, Rob Herring <robh+dt@...nel.org>, Florian Fainelli <f.fainelli@...il.com>, Fabian Frederick <fabf@...net.be>, Alexander Duyck <alexander.h.duyck@...el.com>, Joe Perches <joe@...ches.com>, linux-kernel@...r.kernel.org Subject: Re: [PATCH] net: dsa: fix filling rtable from OF description Hi Andrew В письме от 4 апреля 2015 18:38:14 пользователь Andrew Lunn написал: > There is the code after applying your patch: > > static int dsa_of_setup_routing_table(struct dsa_platform_data *pd, > struct dsa_chip_data *cd, > int chip_index, int port_index, > struct device_node *link) > { > const __be32 *reg; > int link_sw_addr; > struct device_node *parent_sw; > int len; > > parent_sw = of_get_parent(link); > if (!parent_sw) > return -EINVAL; > > link is the phandle to the port in other switch. parent_sw is then the > switch property. yep > reg = of_get_property(parent_sw, "reg", &len); > if (!reg || (len != sizeof(*reg) * 2)) > return -EINVAL; > > So now you get the reg property. This is documented as: > > - reg : Describes the switch address on the MII bus Yes, but read further in the entry example: "reg = <16 0>; /* MDIO address 16, switch 0 in tree */" > link_sw_addr = be32_to_cpup(reg + 1); Now we extract switch number (" + 1"), but not switch MDIO address. > > if (link_sw_addr >= pd->nr_chips) > return -EINVAL; > > This is now not making much sense. > > Looking up the MII bus address seems wrong. You want the chip number, > not its address. Yes, you are right that its wrong to take MII address, but this code is taking switch number, not its address. I can agree that this is silly, but it is not my code originally and patch fixes other thing. -- 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