From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: re: Add support of Cavium Liquidio ethernet adapters
Date: Thu, 25 Jun 2015 09:27:50 +0000 [thread overview]
Message-ID: <20150625092750.GA13888@mwanda> (raw)
In-Reply-To: <20150623142408.GA10121@mwanda>
Hello Raghu Vatsavayi,
The patch f21fb3ed364b: "Add support of Cavium Liquidio ethernet
adapters" from Jun 9, 2015, leads to the following static checker
warning:
drivers/net/ethernet/cavium/liquidio/lio_main.c:2267 liquidio_set_mcast_list()
warn: buffer overflow 'nctrl.udd' 32 <= 32
drivers/net/ethernet/cavium/liquidio/lio_main.c
2236 static void liquidio_set_mcast_list(struct net_device *netdev)
2237 {
2238 struct lio *lio = GET_LIO(netdev);
2239 struct octeon_device *oct = lio->oct_dev;
2240 struct octnic_ctrl_pkt nctrl;
2241 struct octnic_ctrl_params nparams;
2242 struct netdev_hw_addr *ha;
2243 u64 *mc;
2244 int ret, i;
2245 int mc_count = min(netdev_mc_count(netdev), MAX_OCTEON_MULTICAST_ADDR);
2246
2247 memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
2248
2249 /* Create a ctrl pkt command to be sent to core app. */
2250 nctrl.ncmd.u64 = 0;
2251 nctrl.ncmd.s.cmd = OCTNET_CMD_SET_MULTI_LIST;
2252 nctrl.ncmd.s.param1 = lio->linfo.ifidx;
2253 nctrl.ncmd.s.param2 = get_new_flags(netdev);
2254 nctrl.ncmd.s.param3 = mc_count;
2255 nctrl.ncmd.s.more = mc_count;
2256 nctrl.netpndev = (u64)netdev;
2257 nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
2258
2259 /* copy all the addresses into the udd */
2260 i = 0;
2261 mc = &nctrl.udd[0];
2262 netdev_for_each_mc_addr(ha, netdev) {
2263 *mc = 0;
2264 memcpy(((u8 *)mc) + 2, ha->addr, ETH_ALEN);
2265 /* no need to swap bytes */
2266
2267 if (++mc > &nctrl.udd[mc_count])
The static checker will still complain, but I think the ">" should be
">=". The address "&nctrl.udd[mc_count]" is one space beyond the end of
the array.
2268 break;
2269 }
regards,
dan carpenter
next prev parent reply other threads:[~2015-06-25 9:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-23 14:24 Add support of Cavium Liquidio ethernet adapters Dan Carpenter
2015-06-25 9:27 ` Dan Carpenter [this message]
2015-06-26 9:04 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150625092750.GA13888@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).