Skip to contentSkip to conversation

drm/amdgpu: add core driver (v4)

DISCUSSION Dan Carpenter 1 participant 1 message Jun 10, 2015

lore
Share & tools
lore
#0 lore raw

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
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel