[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1408926755-12277-1-git-send-email-broonie@kernel.org>
Date: Sun, 24 Aug 2014 19:32:35 -0500
From: Mark Brown <broonie@...nel.org>
To: Chien Yen <chien.yen@...cle.com>,
"David S. Miller" <davem@...emloft.net>
Cc: rds-devel@....oracle.com, netdev@...r.kernel.org,
linaro-kernel@...ts.linaro.org, Mark Brown <broonie@...aro.org>
Subject: [PATCH] net: rds: Don't allocate rds_sock on stack
From: Mark Brown <broonie@...aro.org>
struct rds_sock is rather large ausing the following warning in an ARM
allmodconfig:
net/rds/iw_rdma.c:200:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]
Fix this by dynamically allocating struct rds_sock in rds_iw_update_cm_id
instead of allocating it on the stack.
Signed-off-by: Mark Brown <broonie@...aro.org>
---
net/rds/iw_rdma.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c
index a817705..cee5daa 100644
--- a/net/rds/iw_rdma.c
+++ b/net/rds/iw_rdma.c
@@ -180,22 +180,28 @@ int rds_iw_update_cm_id(struct rds_iw_device *rds_iwdev, struct rdma_cm_id *cm_i
{
struct sockaddr_in *src_addr, *dst_addr;
struct rds_iw_device *rds_iwdev_old;
- struct rds_sock rs;
+ struct rds_sock *rs;
struct rdma_cm_id *pcm_id;
int rc;
+ rs = kzalloc(sizeof(*rs), GFP_KERNEL);
+ if (!rs)
+ return -ENOMEM;
+
src_addr = (struct sockaddr_in *)&cm_id->route.addr.src_addr;
dst_addr = (struct sockaddr_in *)&cm_id->route.addr.dst_addr;
- rs.rs_bound_addr = src_addr->sin_addr.s_addr;
- rs.rs_bound_port = src_addr->sin_port;
- rs.rs_conn_addr = dst_addr->sin_addr.s_addr;
- rs.rs_conn_port = dst_addr->sin_port;
+ rs->rs_bound_addr = src_addr->sin_addr.s_addr;
+ rs->rs_bound_port = src_addr->sin_port;
+ rs->rs_conn_addr = dst_addr->sin_addr.s_addr;
+ rs->rs_conn_port = dst_addr->sin_port;
- rc = rds_iw_get_device(&rs, &rds_iwdev_old, &pcm_id);
+ rc = rds_iw_get_device(rs, &rds_iwdev_old, &pcm_id);
if (rc)
rds_iw_remove_cm_id(rds_iwdev, cm_id);
+ kfree(rs);
+
return rds_iw_add_cm_id(rds_iwdev, cm_id);
}
--
2.1.0.rc1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists