Thanks Dan for pointing this out. Yes, there is no way tlv can be NULL and I'll fix this.
Thanks, Neerav > -----Original Message----- > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > Sent: Monday, January 20, 2014 10:57 PM > To: Parikh, Neerav > Cc: e1000-devel@lists.sourceforge.net > Subject: re: i40e: implement DCB support infastructure > > Hello Neerav Parikh, > > The patch afb3ff0da4f5: "i40e: implement DCB support infastructure" > from Jan 17, 2014, leads to the following static checker warning: > > drivers/net/ethernet/intel/i40e/i40e_dcb.c:342 > i40e_lldp_to_dcb_config() warn: 'tlv' can't be NULL." > > drivers/net/ethernet/intel/i40e/i40e_dcb.c > 339 /* set to the start of LLDPDU */ > 340 lldpmib += ETH_HLEN; > > lldpmib is non-NULL. > > 341 tlv = (struct i40e_lldp_org_tlv *)lldpmib; > > tlv is non-NULL. > > 342 while (tlv) { > ^^^^^^^^^^^ > This is always true. Better to say "while (1) {" or maybe some other > test was intended? > > 343 typelength = ntohs(tlv->typelength); > 344 type = (u16)((typelength & I40E_LLDP_TLV_TYPE_MASK) >> > 345 I40E_LLDP_TLV_TYPE_SHIFT); > 346 length = (u16)((typelength & I40E_LLDP_TLV_LEN_MASK) > >> > 347 I40E_LLDP_TLV_LEN_SHIFT); > 348 > 349 if (type == I40E_TLV_TYPE_END) > 350 break;/* END TLV break out */ > 351 > 352 switch (type) { > 353 case I40E_TLV_TYPE_ORG: > 354 i40e_parse_org_tlv(tlv, dcbcfg); > 355 break; > 356 default: > 357 break; > 358 } > 359 > 360 /* Move to next TLV */ > 361 tlv = (struct i40e_lldp_org_tlv *)((char *)tlv + > 362 > sizeof(tlv->typelength) + > 363 length); > > We keep adding numbers to tlv and it becomes even more non-zero. > > 364 } > > > regards, > dan carpenter ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ E1000-devel mailing list E1000-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired