[dpdk-dev,v2] net/cxgbe: fix a bug in t4_wr_mbox_meat_timeout

Message ID 1490686340-9340-1-git-send-email-caihe@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

caihe March 28, 2017, 7:32 a.m. UTC
  Check return value of malloc

Signed-off-by: henry <caihe@huawei.com>
---
 drivers/net/cxgbe/base/t4_hw.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Rahul Lakkireddy March 30, 2017, 11:28 a.m. UTC | #1
On Tuesday, March 03/28/17, 2017 at 13:02:20 +0530, henry wrote:
>    Check return value of malloc
> 
>    Signed-off-by: henry <caihe@huawei.com>
>    ---
>     drivers/net/cxgbe/base/t4_hw.c | 3 +++
>     1 file changed, 3 insertions(+)
> 
>    diff --git a/drivers/net/cxgbe/base/t4_hw.c
>    b/drivers/net/cxgbe/base/t4_hw.c
>    index c089b06..9dca8da 100644
>    --- a/drivers/net/cxgbe/base/t4_hw.c
>    +++ b/drivers/net/cxgbe/base/t4_hw.c
>    @@ -359,6 +359,9 @@ 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;
>    --
>    1.8.3.1

Thanks for the fix!

Acked-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
  
Ferruh Yigit March 30, 2017, 4:08 p.m. UTC | #2
On 3/28/2017 8:32 AM, henry wrote:
> Check return value of malloc
> 
> Signed-off-by: henry <caihe@huawei.com>

Hi henry,

Full name is required for sign-off and author fields.

Since patch already acked, if you can provide the information, I can
update the patch while applying, not new version of the patch required.

Required format is:
Name Surname <my@mail.com>

Thanks,
ferruh
  
Ferruh Yigit April 5, 2017, 11:23 a.m. UTC | #3
On 3/30/2017 5:08 PM, Ferruh Yigit wrote:
> On 3/28/2017 8:32 AM, henry wrote:
>> Check return value of malloc
>>
>> Signed-off-by: henry <caihe@huawei.com>
> 
> Hi henry,
> 
> Full name is required for sign-off and author fields.
> 
> Since patch already acked, if you can provide the information, I can
> update the patch while applying, not new version of the patch required.
> 
> Required format is:
> Name Surname <my@mail.com>

"Henry Cai <caihe@huawei.com>"

will be used for author and signed-off fields, based on information
provided by author.

> 
> Thanks,
> ferruh
  
Ferruh Yigit April 7, 2017, 10:50 a.m. UTC | #4
On 3/30/2017 12:28 PM, Rahul Lakkireddy wrote:
> On Tuesday, March 03/28/17, 2017 at 13:02:20 +0530, henry wrote:
>>    Check return value of malloc
>>
>>    Signed-off-by: henry <caihe@huawei.com>

Signed-off-by: Henry Cai <caihe@huawei.com>

> Acked-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index c089b06..9dca8da 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -359,6 +359,9 @@  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;