From: Olof Johansson <hidden> Date: 2012-04-09 04:16:38
I'm not 100% sure if the fix for 'adjust_request' is correct, since
it's uncertain what the original intent was. But it's so clearly an
uninitialized pointer dereference that my resolution seems to make sense.
drivers/video/exynos/exynos_dp_core.c: In function 'exynos_dp_set_link_train':
drivers/video/exynos/exynos_dp_core.c:521:21: warning: 'adjust_request' may be used uninitialized in this function [-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:481:6: note: 'adjust_request' was declared here
drivers/video/exynos/exynos_dp_core.c:529:18: warning: 'reg' may be used uninitialized in this function [-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:395:6: note: 'reg' was declared here
Signed-off-by: Olof Johansson <redacted>
---
drivers/video/exynos/exynos_dp_core.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
@@ -392,24 +392,19 @@ static unsigned int exynos_dp_get_lane_link_training(structexynos_dp_device*dp,intlane){-u32reg;-switch(lane){case0:-reg=exynos_dp_get_lane0_link_training(dp);-break;+returnexynos_dp_get_lane0_link_training(dp);case1:-reg=exynos_dp_get_lane1_link_training(dp);-break;+returnexynos_dp_get_lane1_link_training(dp);case2:-reg=exynos_dp_get_lane2_link_training(dp);-break;+returnexynos_dp_get_lane2_link_training(dp);case3:-reg=exynos_dp_get_lane3_link_training(dp);-break;+returnexynos_dp_get_lane3_link_training(dp);}-returnreg;+WARN_ON(1);+return0;}staticvoidexynos_dp_reduce_link_rate(structexynos_dp_device*dp)
@@ -489,13 +484,13 @@ static int exynos_dp_process_clock_recovery(struct exynos_dp_device *dp)6,link_status);lane_count=dp->link_train.lane_count;+adjust_request=link_status+(DPCD_ADDR_ADJUST_REQUEST_LANE0_1+-DPCD_ADDR_LANE0_1_STATUS);+if(exynos_dp_clock_recovery_ok(link_status,lane_count)=0){/* set training pattern 2 for EQ */exynos_dp_set_training_pattern(dp,TRAINING_PTN2);-adjust_request=link_status+(DPCD_ADDR_ADJUST_REQUEST_LANE0_1--DPCD_ADDR_LANE0_1_STATUS);-exynos_dp_get_adjust_train(dp,adjust_request);buf[0]=DPCD_SCRAMBLING_DISABLED|
From: Jingoo Han <hidden> Date: 2012-04-09 08:46:59
quoted hunk
-----Original Message-----
From: Olof Johansson [mailto:olof@lixom.net]
Sent: Monday, April 09, 2012 1:16 PM
I'm not 100% sure if the fix for 'adjust_request' is correct, since
it's uncertain what the original intent was. But it's so clearly an
uninitialized pointer dereference that my resolution seems to make sense.
drivers/video/exynos/exynos_dp_core.c: In function 'exynos_dp_set_link_train':
drivers/video/exynos/exynos_dp_core.c:521:21: warning: 'adjust_request' may be used uninitialized in
this function [-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:481:6: note: 'adjust_request' was declared here
drivers/video/exynos/exynos_dp_core.c:529:18: warning: 'reg' may be used uninitialized in this function
[-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:395:6: note: 'reg' was declared here
Signed-off-by: Olof Johansson <redacted>
---
drivers/video/exynos/exynos_dp_core.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
It makes the problem. adjust_request will be different.
OK, I understand what you want to do.
I will send the version 2 patch which is simpler.
Thank you for sending the patch.
if (exynos_dp_clock_recovery_ok(link_status, lane_count) = 0) {
/* set training pattern 2 for EQ */
exynos_dp_set_training_pattern(dp, TRAINING_PTN2);
- adjust_request = link_status + (DPCD_ADDR_ADJUST_REQUEST_LANE0_1
- - DPCD_ADDR_LANE0_1_STATUS);
-
exynos_dp_get_adjust_train(dp, adjust_request);
buf[0] = DPCD_SCRAMBLING_DISABLED |
--
1.7.9.2.359.gebfc2
From: Jingoo Han <hidden> Date: 2012-04-09 09:25:57
-----Original Message-----
From: Olof Johansson [mailto:olof@lixom.net]
Sent: Monday, April 09, 2012 1:16 PM
I'm not 100% sure if the fix for 'adjust_request' is correct, since
it's uncertain what the original intent was. But it's so clearly an
uninitialized pointer dereference that my resolution seems to make sense.
drivers/video/exynos/exynos_dp_core.c: In function 'exynos_dp_set_link_train':
drivers/video/exynos/exynos_dp_core.c:521:21: warning: 'adjust_request' may be used uninitialized in
this function [-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:481:6: note: 'adjust_request' was declared here
drivers/video/exynos/exynos_dp_core.c:529:18: warning: 'reg' may be used uninitialized in this function
[-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:395:6: note: 'reg' was declared here
My compiler cannot detect this warning.
What is your compiler version?
@@ -392,24 +392,19 @@ static unsigned int exynos_dp_get_lane_link_training(structexynos_dp_device*dp,intlane){-u32reg;-switch(lane){case0:-reg=exynos_dp_get_lane0_link_training(dp);-break;+returnexynos_dp_get_lane0_link_training(dp);case1:-reg=exynos_dp_get_lane1_link_training(dp);-break;+returnexynos_dp_get_lane1_link_training(dp);case2:-reg=exynos_dp_get_lane2_link_training(dp);-break;+returnexynos_dp_get_lane2_link_training(dp);case3:-reg=exynos_dp_get_lane3_link_training(dp);-break;+returnexynos_dp_get_lane3_link_training(dp);}-returnreg;+WARN_ON(1);+return0;}staticvoidexynos_dp_reduce_link_rate(structexynos_dp_device*dp)
@@ -489,13 +484,13 @@ static int exynos_dp_process_clock_recovery(struct exynos_dp_device *dp)6,link_status);lane_count=dp->link_train.lane_count;+adjust_request=link_status+(DPCD_ADDR_ADJUST_REQUEST_LANE0_1+-DPCD_ADDR_LANE0_1_STATUS);+if(exynos_dp_clock_recovery_ok(link_status,lane_count)=0){/* set training pattern 2 for EQ */exynos_dp_set_training_pattern(dp,TRAINING_PTN2);-adjust_request=link_status+(DPCD_ADDR_ADJUST_REQUEST_LANE0_1--DPCD_ADDR_LANE0_1_STATUS);-exynos_dp_get_adjust_train(dp,adjust_request);buf[0]=DPCD_SCRAMBLING_DISABLED|--
From: Olof Johansson <hidden> Date: 2012-04-09 14:05:34
On Mon, Apr 9, 2012 at 1:46 AM, Jingoo Han [off-list ref] wrote:
quoted
-----Original Message-----
From: Olof Johansson [mailto:olof@lixom.net]
Sent: Monday, April 09, 2012 1:16 PM
I'm not 100% sure if the fix for 'adjust_request' is correct, since
it's uncertain what the original intent was. But it's so clearly an
uninitialized pointer dereference that my resolution seems to make sense.
drivers/video/exynos/exynos_dp_core.c: In function 'exynos_dp_set_link_train':
drivers/video/exynos/exynos_dp_core.c:521:21: warning: 'adjust_request' may be used uninitialized in
this function [-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:481:6: note: 'adjust_request' was declared here
drivers/video/exynos/exynos_dp_core.c:529:18: warning: 'reg' may be used uninitialized in this function
[-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:395:6: note: 'reg' was declared here
Signed-off-by: Olof Johansson <redacted>
---
drivers/video/exynos/exynos_dp_core.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
In a small helper function like this there's nothing wrong with it.
Larger functions? Sure.
Adding a default in the switch didn't seem like an improvement to me.
But I'll leave it up to you.
It makes the problem. adjust_request will be different.
OK, I understand what you want to do.
I will send the version 2 patch which is simpler.
Thank you for sending the patch.
Ok, thanks. As I said, I'm not sure what your intent with the second
(else) code path was.
-Olof
From: Olof Johansson <hidden> Date: 2012-04-09 14:07:17
On Mon, Apr 9, 2012 at 2:25 AM, Jingoo Han [off-list ref] wrote:
quoted
-----Original Message-----
From: Olof Johansson [mailto:olof@lixom.net]
Sent: Monday, April 09, 2012 1:16 PM
I'm not 100% sure if the fix for 'adjust_request' is correct, since
it's uncertain what the original intent was. But it's so clearly an
uninitialized pointer dereference that my resolution seems to make sense.
drivers/video/exynos/exynos_dp_core.c: In function 'exynos_dp_set_link_train':
drivers/video/exynos/exynos_dp_core.c:521:21: warning: 'adjust_request' may be used uninitialized in
this function [-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:481:6: note: 'adjust_request' was declared here
drivers/video/exynos/exynos_dp_core.c:529:18: warning: 'reg' may be used uninitialized in this function
[-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:395:6: note: 'reg' was declared here
My compiler cannot detect this warning.
What is your compiler version?