drm/amdgpu: add core driver (v4)

Dan Carpenter dan.carpenter at oracle.com
Wed Jun 10 08:41:51 PDT 2015


Hello Alex Deucher,

This is a semi-automatic email about new static checker warnings.

The patch d38ceaf99ed0: "drm/amdgpu: add core driver (v4)" from Apr 
20, 2015, leads to the following Smatch complaint:

drivers/gpu/drm/amd/amdgpu/atombios_i2c.c:68 amdgpu_atombios_i2c_process_i2c_ch()
	 error: we previously assumed 'buf' could be null (see line 61)

drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
    60			}
    61			if (buf == NULL)
                            ^^^^^^^^^^^
Check.

    62				args.ucRegIndex = 0;
    63			else
    64				args.ucRegIndex = buf[0];
    65			if (num)
    66				num--;
    67			if (num)
    68				memcpy(&out, &buf[1], num);
                                              ^^^^^
Not checked.  It's possible it was intended to set "num" ot zero instead
of args.ucRegIndex?  Also memcpy() with a size zero is a no-op so the if
statement could be removed if you want.

    69			args.lpI2CDataOut = cpu_to_le16(out);
    70		} else {

regards,
dan carpenter


More information about the dri-devel mailing list