drivers: modem: ublox-sara-r4: Fix dereference before null check
Fixes #32916 Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
This commit is contained in:
parent
066be0a45e
commit
30c9588aaa
1 changed files with 4 additions and 4 deletions
|
@ -314,6 +314,10 @@ static ssize_t send_socket_data(void *obj,
|
|||
struct sockaddr *dst_addr = msg->msg_name;
|
||||
size_t buf_len = 0;
|
||||
|
||||
if (!sock) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (int i = 0; i < msg->msg_iovlen; i++) {
|
||||
if (!msg->msg_iov[i].iov_base || msg->msg_iov[i].iov_len == 0) {
|
||||
errno = EINVAL;
|
||||
|
@ -331,10 +335,6 @@ static ssize_t send_socket_data(void *obj,
|
|||
dst_addr = &sock->dst;
|
||||
}
|
||||
|
||||
if (!sock) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Binary and ASCII mode allows sending MDM_MAX_DATA_LENGTH bytes to
|
||||
* the socket in one command
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue