[PATCH] amd/display: Fix potential null dereference in dce_calcs.c

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

 



Reported by smatch:
bw_calcs() error: potential null dereference 'data'

Signed-off-by: Ernst Sjöstrand <ernstp at gmail.com>
---
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
index 4f8a95368ffc..64a885195208 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
+++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
@@ -2794,6 +2794,10 @@ bool bw_calcs(struct dc_context *ctx,
 {
 	struct bw_calcs_data *data = kzalloc(sizeof(struct bw_calcs_data),
 					     GFP_KERNEL);
+	if (!data) {
+		DRM_ERROR("Failed to allocate bw_calcs_data\n");
+		return false;
+	}
 
 	populate_initial_data(pipe, pipe_count, data);
 
-- 
2.14.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux