diff mbox

[1/1] drivers/infiniband/core/verbs.c: fix build with gcc-4.4.4

Message ID 20180313215157.GL3mSm-p6%akpm@linux-foundation.org (mailing list archive)
State Accepted
Headers show

Commit Message

Andrew Morton March 13, 2018, 9:51 p.m. UTC
From: Andrew Morton <akpm@linux-foundation.org>
Subject: drivers/infiniband/core/verbs.c: fix build with gcc-4.4.4

gcc-4.4.4 has issues with initialization of anonymous unions.

drivers/infiniband/core/verbs.c: In function '__ib_drain_sq':
drivers/infiniband/core/verbs.c:2204: error: unknown field 'wr_cqe' specified in initializer
drivers/infiniband/core/verbs.c:2204: warning: initialization makes integer from pointer without a cast

Work around this.

Fixes: a1ae7d0345edd5 ("RDMA/core: Avoid that ib_drain_qp() triggers an out-of-bounds stack access")
Cc: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Steve Wise <swise@opengridcomputing.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Jason Gunthorpe <jgg@mellanox.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/infiniband/core/verbs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Doug Ledford March 14, 2018, 8:41 p.m. UTC | #1
On Tue, 2018-03-13 at 14:51 -0700, akpm@linux-foundation.org wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: drivers/infiniband/core/verbs.c: fix build with gcc-4.4.4
> 
> gcc-4.4.4 has issues with initialization of anonymous unions.

That compiler was released in April of 2010, almost a full 8 years ago. 
What still uses it, and do we seriously care?

> 
> drivers/infiniband/core/verbs.c: In function '__ib_drain_sq':
> drivers/infiniband/core/verbs.c:2204: error: unknown field 'wr_cqe' specified in initializer
> drivers/infiniband/core/verbs.c:2204: warning: initialization makes integer from pointer without a cast
> 
> Work around this.
> 
> Fixes: a1ae7d0345edd5 ("RDMA/core: Avoid that ib_drain_qp() triggers an out-of-bounds stack access")
> Cc: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Steve Wise <swise@opengridcomputing.com>
> Cc: Sagi Grimberg <sagi@grimberg.me>
> Cc: Jason Gunthorpe <jgg@mellanox.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/infiniband/core/verbs.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff -puN drivers/infiniband/core/verbs.c~drivers-infiniband-core-verbsc-fix-build-with-gcc-444 drivers/infiniband/core/verbs.c
> --- a/drivers/infiniband/core/verbs.c~drivers-infiniband-core-verbsc-fix-build-with-gcc-444
> +++ a/drivers/infiniband/core/verbs.c
> @@ -2200,8 +2200,9 @@ static void __ib_drain_sq(struct ib_qp *
>  	struct ib_send_wr *bad_swr;
>  	struct ib_rdma_wr swr = {
>  		.wr = {
> +			.next = NULL,
> +			{ .wr_cqe	= &sdrain.cqe, },
>  			.opcode	= IB_WR_RDMA_WRITE,
> -			.wr_cqe	= &sdrain.cqe,
>  		},
>  	};
>  	int ret;
> _
> --
> 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
Andrew Morton March 14, 2018, 9:08 p.m. UTC | #2
On Wed, 14 Mar 2018 16:41:00 -0400 Doug Ledford <dledford@redhat.com> wrote:

> On Tue, 2018-03-13 at 14:51 -0700, akpm@linux-foundation.org wrote:
> > From: Andrew Morton <akpm@linux-foundation.org>
> > Subject: drivers/infiniband/core/verbs.c: fix build with gcc-4.4.4
> > 
> > gcc-4.4.4 has issues with initialization of anonymous unions.
> 
> That compiler was released in April of 2010, almost a full 8 years ago. 
> What still uses it, and do we seriously care?

Documentation/Changes still says gcc-3.2.  A few people are using the
older versions.  There's talk going around about requiring something
more recent but nothing has happened yet.


--
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
Doug Ledford March 14, 2018, 9:12 p.m. UTC | #3
On Wed, 2018-03-14 at 14:08 -0700, Andrew Morton wrote:
> On Wed, 14 Mar 2018 16:41:00 -0400 Doug Ledford <dledford@redhat.com> wrote:
> 
> > On Tue, 2018-03-13 at 14:51 -0700, akpm@linux-foundation.org wrote:
> > > From: Andrew Morton <akpm@linux-foundation.org>
> > > Subject: drivers/infiniband/core/verbs.c: fix build with gcc-4.4.4
> > > 
> > > gcc-4.4.4 has issues with initialization of anonymous unions.
> > 
> > That compiler was released in April of 2010, almost a full 8 years ago. 
> > What still uses it, and do we seriously care?
> 
> Documentation/Changes still says gcc-3.2.  A few people are using the
> older versions.  There's talk going around about requiring something
> more recent but nothing has happened yet.

OK, count this as a grumble about the outdated compiler requirement :-/. 
The code this patches looks nice and clean, this patch uglies it up.
Doug Ledford March 14, 2018, 10:15 p.m. UTC | #4
On Wed, 2018-03-14 at 17:12 -0400, Doug Ledford wrote:
> On Wed, 2018-03-14 at 14:08 -0700, Andrew Morton wrote:
> > On Wed, 14 Mar 2018 16:41:00 -0400 Doug Ledford <dledford@redhat.com> wrote:
> > 
> > > On Tue, 2018-03-13 at 14:51 -0700, akpm@linux-foundation.org wrote:
> > > > From: Andrew Morton <akpm@linux-foundation.org>
> > > > Subject: drivers/infiniband/core/verbs.c: fix build with gcc-4.4.4
> > > > 
> > > > gcc-4.4.4 has issues with initialization of anonymous unions.
> > > 
> > > That compiler was released in April of 2010, almost a full 8 years ago. 
> > > What still uses it, and do we seriously care?
> > 
> > Documentation/Changes still says gcc-3.2.  A few people are using the
> > older versions.  There's talk going around about requiring something
> > more recent but nothing has happened yet.
> 
> OK, count this as a grumble about the outdated compiler requirement :-/. 
> The code this patches looks nice and clean, this patch uglies it up.
> 

If it wasn't obvious BTW, this and the other patch you sent have been
applied to for-next area, begrudgingly ;-)
diff mbox

Patch

diff -puN drivers/infiniband/core/verbs.c~drivers-infiniband-core-verbsc-fix-build-with-gcc-444 drivers/infiniband/core/verbs.c
--- a/drivers/infiniband/core/verbs.c~drivers-infiniband-core-verbsc-fix-build-with-gcc-444
+++ a/drivers/infiniband/core/verbs.c
@@ -2200,8 +2200,9 @@  static void __ib_drain_sq(struct ib_qp *
 	struct ib_send_wr *bad_swr;
 	struct ib_rdma_wr swr = {
 		.wr = {
+			.next = NULL,
+			{ .wr_cqe	= &sdrain.cqe, },
 			.opcode	= IB_WR_RDMA_WRITE,
-			.wr_cqe	= &sdrain.cqe,
 		},
 	};
 	int ret;