projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e9c227b
)
drm/amd/amdgpu: Fix missing null check in atombios_i2c.c
author
Ernst Sjöstrand
<
[email protected]
>
Sun, 19 Nov 2017 17:52:44 +0000
(18:52 +0100)
committer
Alex Deucher
<
[email protected]
>
Wed, 6 Dec 2017 17:47:59 +0000
(12:47 -0500)
Reported by smatch:
amdgpu_atombios_i2c_process_i2c_ch() error: we previously assumed 'buf' could be null
Reviewed-by: Alex Deucher <
[email protected]
>
Signed-off-by: Ernst Sjöstrand <
[email protected]
>
Signed-off-by: Alex Deucher <
[email protected]
>
drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
index b374653bd6cf39849db7570583f7cd2b082c3518..f9b2ce9a98f3e862de6b004eb80b8398e32803c5 100644
(file)
--- a/
drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
+++ b/
drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
@@
-65,8
+65,15
@@
static int amdgpu_atombios_i2c_process_i2c_ch(struct amdgpu_i2c_chan *chan,
args.ucRegIndex = buf[0];
if (num)
num--;
- if (num)
- memcpy(&out, &buf[1], num);
+ if (num) {
+ if (buf) {
+ memcpy(&out, &buf[1], num);
+ } else {
+ DRM_ERROR("hw i2c: missing buf with num > 1\n");
+ r = -EINVAL;
+ goto done;
+ }
+ }
args.lpI2CDataOut = cpu_to_le16(out);
} else {
if (num > ATOM_MAX_HW_I2C_READ) {