All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] net/cxgbe: check return value of malloc
@ 2017-03-25 12:44 caihe
  2017-03-27  7:35 ` Rahul Lakkireddy
  0 siblings, 1 reply; 2+ messages in thread
From: caihe @ 2017-03-25 12:44 UTC (permalink / raw)
  To: rahul.lakkireddy; +Cc: dev, wangyunjian, Lilijun (Jerry), Zhoujingbin

Hi rahul,

There is a bug without check the return value of alloc memory in function t4_wr_mbox_meat_timeout, if we should fix it as below:

diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index c089b06..7402a5f 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -359,6 +359,10 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
        struct mbox_entry entry;
        u32 pcie_fw = 0;
 
+       if (!temp) {
+               return -ENOMEM;
+       }
+
        if ((size & 15) || size > MBOX_LEN) {
                free(temp);
                return -EINVAL;

Best Regards

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] net/cxgbe: check return value of malloc
  2017-03-25 12:44 [PATCH 1/1] net/cxgbe: check return value of malloc caihe
@ 2017-03-27  7:35 ` Rahul Lakkireddy
  0 siblings, 0 replies; 2+ messages in thread
From: Rahul Lakkireddy @ 2017-03-27  7:35 UTC (permalink / raw)
  To: caihe
  Cc: dev, wangyunjian, Lilijun (Jerry),
	Zhoujingbin, Kumar Sanghvi, Nirranjan Kirubaharan

On Saturday, March 03/25/17, 2017 at 18:14:29 +0530, caihe wrote:
>    Hi rahul,
> 
>    There is a bug without check the return value of alloc memory in function
>    t4_wr_mbox_meat_timeout, if we should fix it as below:
> 
>    diff --git a/drivers/net/cxgbe/base/t4_hw.c
>    b/drivers/net/cxgbe/base/t4_hw.c
>    index c089b06..7402a5f 100644
>    --- a/drivers/net/cxgbe/base/t4_hw.c
>    +++ b/drivers/net/cxgbe/base/t4_hw.c
>    @@ -359,6 +359,10 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int
>    mbox,
>            struct mbox_entry entry;
>            u32 pcie_fw = 0;
>     
>    +       if (!temp) {
>    +               return -ENOMEM;
>    +       }
>    +
>            if ((size & 15) || size > MBOX_LEN) {
>                    free(temp);
>                    return -EINVAL;
> 
>    Best Regards

Thanks for the fix!  However, there seem to be checkpatch issues with
the patch that need to be fixed.

http://dpdk.org/ml/archives/test-report/2017-March/015606.html

Thanks,
Rahul

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-27  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-25 12:44 [PATCH 1/1] net/cxgbe: check return value of malloc caihe
2017-03-27  7:35 ` Rahul Lakkireddy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.