diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2017-08-11 21:55:15 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-08-18 03:10:46 -0400 |
commit | 3c2c42eb47f2e2272e0cc244751cd312e18d5142 (patch) | |
tree | cf6b9382823e50bd1ec6d8eacf0148199e55cff4 | |
parent | f3bbc908e87384785c26b6fa71d1c0beb126797c (diff) |
drm/gma500: fix potential NULL pointer dereference dereference
NULL check at line 528: if (!sender || !data_out || !len_out) {, implies
that pointer _sender_ might be NULL.
Move pointer _sender_ dereference after NULL check in order to avoid a
potential NULL pointer dereference.
This issue was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20170812015515.GA8360@embeddedgus
-rw-r--r-- | drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c index 1616af209bfc..c50534c923df 100644 --- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c +++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | |||
@@ -520,7 +520,7 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type, | |||
520 | u8 *data, u16 len, u32 *data_out, u16 len_out, bool hs) | 520 | u8 *data, u16 len, u32 *data_out, u16 len_out, bool hs) |
521 | { | 521 | { |
522 | unsigned long flags; | 522 | unsigned long flags; |
523 | struct drm_device *dev = sender->dev; | 523 | struct drm_device *dev; |
524 | int i; | 524 | int i; |
525 | u32 gen_data_reg; | 525 | u32 gen_data_reg; |
526 | int retry = MDFLD_DSI_READ_MAX_COUNT; | 526 | int retry = MDFLD_DSI_READ_MAX_COUNT; |
@@ -530,6 +530,8 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type, | |||
530 | return -EINVAL; | 530 | return -EINVAL; |
531 | } | 531 | } |
532 | 532 | ||
533 | dev = sender->dev; | ||
534 | |||
533 | /** | 535 | /** |
534 | * do reading. | 536 | * do reading. |
535 | * 0) send out generic read request | 537 | * 0) send out generic read request |