Message ID | 1444403708-16576-1-git-send-email-gerlando.falauto@keymile.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Hi Gerlando, [auto build test WARNING on net/master -- if it's inappropriate base, please ignore] config: powerpc-tqm8541_defconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=powerpc All warnings (new ones prefixed by >>): drivers/net/ethernet/freescale/fsl_pq_mdio.c: In function 'fsl_pq_mdio_probe': >> drivers/net/ethernet/freescale/fsl_pq_mdio.c:454:14: warning: comparison of distinct pointer types lacks a cast if (tbipa > priv->map + resource_size(&res)) ^ vim +454 drivers/net/ethernet/freescale/fsl_pq_mdio.c 438 if (!prop) { 439 dev_err(&pdev->dev, 440 "missing 'reg' property in node %s\n", 441 tbi->full_name); 442 err = -EBUSY; 443 goto error; 444 } 445 446 tbipa = data->get_tbipa(priv->map); 447 448 /* 449 * Add consistency check to make sure TBI is contained 450 * within the mapped range (not because we would get a 451 * segfault, rather to catch bugs in computing TBI 452 * address). Print error message but continue anyway. 453 */ > 454 if (tbipa > priv->map + resource_size(&res)) 455 dev_err(&pdev->dev, "invalid register map (should be at least 0x%04x to contain TBI address)\n", 456 ((void *)tbipa - priv->map) + 4); 457 458 iowrite32be(be32_to_cpup(prop), tbipa); 459 } 460 } 461 462 if (data->ucc_configure) --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Gerlando Falauto wrote: > > Change-Id: If1e7d8931f440ea9259726c36d3df797dda016fb You need to remove these from patches that are emailed, and fix the pointer type comparison. Otherwise, Acked-by: Timur Tabi <timur@tabi.org> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index 3c40f6b..4618011 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -445,6 +445,16 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) tbipa = data->get_tbipa(priv->map); + /* + * Add consistency check to make sure TBI is contained + * within the mapped range (not because we would get a + * segfault, rather to catch bugs in computing TBI + * address). Print error message but continue anyway. + */ + if (tbipa > priv->map + resource_size(&res)) + dev_err(&pdev->dev, "invalid register map (should be at least 0x%04x to contain TBI address)\n", + ((void *)tbipa - priv->map) + 4); + iowrite32be(be32_to_cpup(prop), tbipa); } }
When configuring the MDIO subsystem it is also necessary to configure the TBI register. Make sure the TBI is contained within the mapped register range in order to: a) make sure the address is computed correctly b) make users aware that we're actually accessing that register In case of error, print a message but continue anyway. Change-Id: If1e7d8931f440ea9259726c36d3df797dda016fb Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com> Cc: Timur Tabi <timur@freescale.com> Cc: David S. Miller <davem@davemloft.net> Cc: Andy Fleming <afleming@freescale.com> Cc: Kumar Gala <galak@kernel.crashing.org> --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 10 ++++++++++ 1 file changed, 10 insertions(+)