drivers/net/ethernet/intel/igb/igb_ptp.c:397: warning: array subscript is below array bounds

From: kbuild test robot
Date: Sat Dec 24 2016 - 23:09:05 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7c0f6ba682b9c7632072ffbedf8d328c8f3c42ba
commit: d1cbfd771ce8297fa11e89f315392de6056a2181 ptp_clock: Allow for it to be optional
date: 6 weeks ago
config: x86_64-randconfig-s1-12251102 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
git checkout d1cbfd771ce8297fa11e89f315392de6056a2181
# save the attached .config to linux build tree
make ARCH=x86_64

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.

All warnings (new ones prefixed by >>):

drivers/net/ethernet/intel/igb/igb_ptp.c: In function 'igb_ptp_feature_enable_i210':
>> drivers/net/ethernet/intel/igb/igb_ptp.c:397: warning: array subscript is below array bounds
drivers/net/ethernet/intel/igb/igb_ptp.c:400: warning: array subscript is below array bounds
drivers/net/ethernet/intel/igb/igb_ptp.c:452: warning: array subscript is below array bounds
drivers/net/ethernet/intel/igb/igb_ptp.c:455: warning: array subscript is below array bounds
drivers/net/ethernet/intel/igb/igb_ptp.c:458: warning: array subscript is below array bounds
drivers/net/ethernet/intel/igb/igb_ptp.c:460: warning: array subscript is below array bounds
drivers/net/ethernet/intel/igb/igb_ptp.c:463: warning: array subscript is below array bounds
drivers/net/ethernet/intel/igb/igb_ptp.c:465: warning: array subscript is below array bounds
drivers/net/ethernet/intel/igb/igb_ptp.c:467: warning: array subscript is below array bounds

vim +397 drivers/net/ethernet/intel/igb/igb_ptp.c

720db4ff Richard Cochran 2014-11-21 381 TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN,
720db4ff Richard Cochran 2014-11-21 382 };
b23c0cc5 Alexander Duyck 2015-03-06 383 struct e1000_hw *hw = &igb->hw;
720db4ff Richard Cochran 2014-11-21 384 u32 ctrl, ctrl_ext, tssdp = 0;
720db4ff Richard Cochran 2014-11-21 385
720db4ff Richard Cochran 2014-11-21 386 ctrl = rd32(E1000_CTRL);
720db4ff Richard Cochran 2014-11-21 387 ctrl_ext = rd32(E1000_CTRL_EXT);
720db4ff Richard Cochran 2014-11-21 388 tssdp = rd32(E1000_TSSDP);
720db4ff Richard Cochran 2014-11-21 389
720db4ff Richard Cochran 2014-11-21 390 igb_pin_direction(pin, 1, &ctrl, &ctrl_ext);
720db4ff Richard Cochran 2014-11-21 391
720db4ff Richard Cochran 2014-11-21 392 /* Make sure this pin is not enabled as an output. */
720db4ff Richard Cochran 2014-11-21 393 tssdp &= ~ts_sdp_en[pin];
720db4ff Richard Cochran 2014-11-21 394
720db4ff Richard Cochran 2014-11-21 395 if (chan == 1) {
720db4ff Richard Cochran 2014-11-21 396 tssdp &= ~AUX1_SEL_SDP3;
720db4ff Richard Cochran 2014-11-21 @397 tssdp |= aux1_sel_sdp[pin] | AUX1_TS_SDP_EN;
720db4ff Richard Cochran 2014-11-21 398 } else {
720db4ff Richard Cochran 2014-11-21 399 tssdp &= ~AUX0_SEL_SDP3;
720db4ff Richard Cochran 2014-11-21 400 tssdp |= aux0_sel_sdp[pin] | AUX0_TS_SDP_EN;
720db4ff Richard Cochran 2014-11-21 401 }
720db4ff Richard Cochran 2014-11-21 402
720db4ff Richard Cochran 2014-11-21 403 wr32(E1000_TSSDP, tssdp);
720db4ff Richard Cochran 2014-11-21 404 wr32(E1000_CTRL, ctrl);
720db4ff Richard Cochran 2014-11-21 405 wr32(E1000_CTRL_EXT, ctrl_ext);

:::::: The code at line 397 was first introduced by commit
:::::: 720db4ffd0846570c1ddc82e7bb661ab0a676fad igb: enable auxiliary PHC functions for the i210

:::::: TO: Richard Cochran <richardcochran@xxxxxxxxx>
:::::: CC: Jeff Kirsher <jeffrey.t.kirsher@xxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip