diff mbox

[3/3] IB/srpt: fix compilation warning

Message ID 1482922813-8392-4-git-send-email-maxg@mellanox.com (mailing list archive)
State Rejected
Headers show

Commit Message

Max Gurtovoy Dec. 28, 2016, 11 a.m. UTC
warning: 'prev_nents' may be used uninitialized in this function

Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Yuval Shaia Dec. 28, 2016, 11:18 a.m. UTC | #1
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>

On Wed, Dec 28, 2016 at 01:00:13PM +0200, Max Gurtovoy wrote:
> warning: 'prev_nents' may be used uninitialized in this function
> 
> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
> ---
>  drivers/infiniband/ulp/srpt/ib_srpt.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index aa18d74..b36f9a5 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -809,7 +809,7 @@ static int srpt_alloc_rw_ctxs(struct srpt_send_ioctx *ioctx,
>  	enum dma_data_direction dir = target_reverse_dma_direction(&ioctx->cmd);
>  	struct srpt_rdma_ch *ch = ioctx->ch;
>  	struct scatterlist *prev = NULL;
> -	unsigned prev_nents;
> +	unsigned prev_nents = 0;
>  	int ret, i;
>  
>  	if (nbufs == 1) {
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bart Van Assche Dec. 28, 2016, 11:41 a.m. UTC | #2
T24gV2VkLCAyMDE2LTEyLTI4IGF0IDEzOjAwICswMjAwLCBNYXggR3VydG92b3kgd3JvdGU6DQo+
IHdhcm5pbmc6ICdwcmV2X25lbnRzJyBtYXkgYmUgdXNlZCB1bmluaXRpYWxpemVkIGluIHRoaXMg
ZnVuY3Rpb24NCg0KV2hhdCBjb21waWxlciBhbmQgd2hpY2ggdmVyc2lvbiBvZiB0aGF0IGNvbXBp
bGVyIHJlcG9ydGVkIHRoYXQgJ3ByZXZfbmVudHMnDQptYXkgYmUgdXNlZCB1bmluaXRpYWxpemVk
PyBUaGF0IHdhcm5pbmcgaW5kaWNhdGVzIGEgY29tcGlsZXIgYnVnLiBSZWNlbnQNCnZlcnNpb25z
IG9mIGdjYyBkbyBub3QgcmVwb3J0IHRoYXQgd2FybmluZy4gUGF0Y2hlcyB0aGF0IHN1cHByZXNz
IHdhcm5pbmdzDQp0aGF0IGFyZSByZXBvcnRlZCBieSBidWdzIGluIG9sZCBjb21waWxlciB2ZXJz
aW9ucyBzaG91bGQgbm90IGJlIHNlbnQgdXBzdHJlYW0uDQoNCkJhcnQu
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Max Gurtovoy Dec. 28, 2016, 11:44 a.m. UTC | #3
On 12/28/2016 1:41 PM, Bart Van Assche wrote:
> On Wed, 2016-12-28 at 13:00 +0200, Max Gurtovoy wrote:
>> warning: 'prev_nents' may be used uninitialized in this function
>
> What compiler and which version of that compiler reported that 'prev_nents'
> may be used uninitialized? That warning indicates a compiler bug. Recent
> versions of gcc do not report that warning. Patches that suppress warnings
> that are reported by bugs in old compiler versions should not be sent upstream.
>
> Bart.
>

gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
I'll remove this patch in V2.

Thanks,
Max.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index aa18d74..b36f9a5 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -809,7 +809,7 @@  static int srpt_alloc_rw_ctxs(struct srpt_send_ioctx *ioctx,
 	enum dma_data_direction dir = target_reverse_dma_direction(&ioctx->cmd);
 	struct srpt_rdma_ch *ch = ioctx->ch;
 	struct scatterlist *prev = NULL;
-	unsigned prev_nents;
+	unsigned prev_nents = 0;
 	int ret, i;
 
 	if (nbufs == 1) {