* [PATCH] net/memif: remove pointer deference before null check
@ 2022-02-09 7:27 Weiguo Li
2022-02-09 7:39 ` [PATCH v2] " Weiguo Li
0 siblings, 1 reply; 4+ messages in thread
From: Weiguo Li @ 2022-02-09 7:27 UTC (permalink / raw)
To: jgrajcia; +Cc: dev
There are duplicates of asignment here, the one before null check
may cause a null pointer deference, so remove the previous one.
Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
drivers/net/memif/memif_socket.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 42f48a68a1..7886644412 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -402,11 +402,10 @@ memif_msg_enq_init(struct rte_eth_dev *dev)
{
struct pmd_internals *pmd = dev->data->dev_private;
struct memif_msg_queue_elt *e = memif_msg_enq(pmd->cc);
- memif_msg_init_t *i = &e->msg.init;
+ memif_msg_init_t *i;
if (e == NULL)
return -1;
-
i = &e->msg.init;
e->msg.type = MEMIF_MSG_TYPE_INIT;
i->version = MEMIF_VERSION;
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] net/memif: remove pointer deference before null check
2022-02-09 7:27 [PATCH] net/memif: remove pointer deference before null check Weiguo Li
@ 2022-02-09 7:39 ` Weiguo Li
2022-02-09 13:56 ` Ferruh Yigit
0 siblings, 1 reply; 4+ messages in thread
From: Weiguo Li @ 2022-02-09 7:39 UTC (permalink / raw)
To: jgrajcia; +Cc: dev
There are duplicates of assignment here, the one before null check
may cause a null pointer deference, so remove the previous one.
Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
v2:
* fix typo
---
drivers/net/memif/memif_socket.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 42f48a68a1..7886644412 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -402,11 +402,10 @@ memif_msg_enq_init(struct rte_eth_dev *dev)
{
struct pmd_internals *pmd = dev->data->dev_private;
struct memif_msg_queue_elt *e = memif_msg_enq(pmd->cc);
- memif_msg_init_t *i = &e->msg.init;
+ memif_msg_init_t *i;
if (e == NULL)
return -1;
-
i = &e->msg.init;
e->msg.type = MEMIF_MSG_TYPE_INIT;
i->version = MEMIF_VERSION;
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] net/memif: remove pointer deference before null check
2022-02-09 7:39 ` [PATCH v2] " Weiguo Li
@ 2022-02-09 13:56 ` Ferruh Yigit
2022-02-09 17:51 ` Ferruh Yigit
0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2022-02-09 13:56 UTC (permalink / raw)
To: Weiguo Li, jgrajcia; +Cc: dev, stable
On 2/9/2022 7:39 AM, Weiguo Li wrote:
> There are duplicates of assignment here, the one before null check
> may cause a null pointer deference, so remove the previous one.
>
> Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
>
Cc: stable@dpdk.org
> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] net/memif: remove pointer deference before null check
2022-02-09 13:56 ` Ferruh Yigit
@ 2022-02-09 17:51 ` Ferruh Yigit
0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2022-02-09 17:51 UTC (permalink / raw)
To: Weiguo Li, jgrajcia; +Cc: dev, stable
On 2/9/2022 1:56 PM, Ferruh Yigit wrote:
> On 2/9/2022 7:39 AM, Weiguo Li wrote:
>> There are duplicates of assignment here, the one before null check
>> may cause a null pointer deference, so remove the previous one.
>>
>> Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
>>
>
> Cc: stable@dpdk.org
>
>> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-09 17:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 7:27 [PATCH] net/memif: remove pointer deference before null check Weiguo Li
2022-02-09 7:39 ` [PATCH v2] " Weiguo Li
2022-02-09 13:56 ` Ferruh Yigit
2022-02-09 17:51 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).