[smatch stuff] xgifb: read outside array inxgifb_probe()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Aaro,

Can xgifb_mode_idx be set to -1 here?

drivers/staging/xgifb/XGI_main_26.c +2329 xgifb_probe(302)
	error: testing array offset 'xgifb_mode_idx' after use.

  2189   if (!XGIfb_GetXG21LVDSData()) {
  2190   	int m;
  2191          for (m = 0; m < sizeof(XGI21_LCDCapList)/sizeof(struct XGI21_LVDSCapStruct); m++) {
  2192          	if ((XGI21_LCDCapList[m].LVDSHDE == XGIbios_mode[xgifb_mode_idx].xres) &&
                                                                         ^^^^^^^^^^^^^^

  2193                      (XGI21_LCDCapList[m].LVDSVDE == XGIbios_mode[xgifb_mode_idx].yres)) {
                                                                         ^^^^^^^^^^^^^^
  2194                  	xgifb_reg_set(XGI_Pr.P3d4, 0x36, m);
  2195                  }
  2196          }
  2197   }

Smatch complains that we test for this later in the function but we
don't test for it here.

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux