lkml.org 
[lkml]   [2023]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] net: lan78xx: Fix possible uninit bug
The variable buf should be initialized in the function lan78xx_read_reg.
However, there is no return value check, which means the variable buf
could still be uninit. But there is a read later.

Signed-off-by: Yu Hao <yhao016@ucr.edu>
---
drivers/net/usb/lan78xx.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index c458c030fadf..4c9318c92fe6 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1091,8 +1091,11 @@ static int lan78xx_write_raw_otp(struct
lan78xx_net *dev, u32 offset,
int i;
u32 buf;
unsigned long timeout;
+ int ret;

- lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
+ ret = lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
+ if (ret < 0)
+ return ret;

if (buf & OTP_PWR_DN_PWRDN_N_) {
/* clear it and wait to be cleared */
--
2.34.1
\
 
 \ /
  Last update: 2023-07-05 03:15    [W:0.032 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site