* [PATCH] IB/core: Allocating larger memory than required for cma_configfs
@ 2015-12-30 14:14 Matan Barak
[not found] ` <1451484858-1530-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Matan Barak @ 2015-12-30 14:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Majd Dibbiny,
Moni Shoua, Matan Barak
We were allocating larger memory space than requried for
cma_dev_group->default_ports_group.
Fixes: 045959db65c6 ('IB/cma: Add configfs for rdma_cm')
Signed-off-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
Hi Doug,
This patch fixes a small issue, where we allocated more space than we
actually needed. This was introduces in the RoCE v2 series.
Regards,
Matan
drivers/infiniband/core/cma_configfs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
index bd1d640..ab554df 100644
--- a/drivers/infiniband/core/cma_configfs.c
+++ b/drivers/infiniband/core/cma_configfs.c
@@ -169,9 +169,10 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
ports = kcalloc(ports_num, sizeof(*cma_dev_group->ports),
GFP_KERNEL);
- cma_dev_group->default_ports_group = kcalloc(ports_num + 1,
- sizeof(*cma_dev_group->ports),
- GFP_KERNEL);
+ cma_dev_group->default_ports_group =
+ kcalloc(ports_num + 1,
+ sizeof(*cma_dev_group->default_ports_group),
+ GFP_KERNEL);
if (!ports || !cma_dev_group->default_ports_group) {
err = -ENOMEM;
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] IB/core: Eliminate sparse false positive warning on context imbalance
[not found] ` <1451484858-1530-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2015-12-30 14:14 ` Matan Barak
2015-12-30 14:14 ` [PATCH] IB/core: Fix dereference before check Matan Barak
2015-12-31 7:50 ` [PATCH] IB/core: Allocating larger memory than required for cma_configfs Bart Van Assche
2 siblings, 0 replies; 5+ messages in thread
From: Matan Barak @ 2015-12-30 14:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Majd Dibbiny,
Moni Shoua, Matan Barak
When write_gid function needs to do a sleep-able operation, it unlocks
table->rwlock and then relocks it. Sparse complains about context
imbalance.
This is safe as write_gid is always called with table->rwlock.
write_gid protects from simultaneous writes to this GID entry
by setting the GID_TABLE_ENTRY_INVALID flag.
Fixes: 9c584f049596 ('IB/core: Change per-entry lock in RoCE GID table to
one lock')
Signed-off-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
Hi Doug,
This patch eliminates a sparse false-positive warning about context
imbalance. We use __releases and __acquires in order to do so.
Regards,
Matan
drivers/infiniband/core/cache.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 92cadbd..53343ff 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -174,6 +174,7 @@ static int write_gid(struct ib_device *ib_dev, u8 port,
const struct ib_gid_attr *attr,
enum gid_table_write_action action,
bool default_gid)
+ __releases(&table->rwlock) __acquires(&table->rwlock)
{
int ret = 0;
struct net_device *old_net_dev;
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] IB/core: Fix dereference before check
[not found] ` <1451484858-1530-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-30 14:14 ` [PATCH] IB/core: Eliminate sparse false positive warning on context imbalance Matan Barak
@ 2015-12-30 14:14 ` Matan Barak
2015-12-31 7:50 ` [PATCH] IB/core: Allocating larger memory than required for cma_configfs Bart Van Assche
2 siblings, 0 replies; 5+ messages in thread
From: Matan Barak @ 2015-12-30 14:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Majd Dibbiny,
Moni Shoua, Matan Barak
Sparse complains about dereference before check. Fixing this by
moving the check before the dereference.
Fixes: 200298326b27 ('IB/core: Validate route when we init ah')
Signed-off-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
Hi Doug,
This patch eliminates a deference before check sparse false warning.
This was introduced in the RoCE v2 series.
Regards,
Matan
drivers/infiniband/core/addr.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 0b5f245..791cc98 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -497,13 +497,14 @@ int rdma_resolve_ip_route(struct sockaddr *src_addr,
struct sockaddr_storage ssrc_addr = {};
struct sockaddr *src_in = (struct sockaddr *)&ssrc_addr;
- if (src_addr->sa_family != dst_addr->sa_family)
- return -EINVAL;
+ if (src_addr) {
+ if (src_addr->sa_family != dst_addr->sa_family)
+ return -EINVAL;
- if (src_addr)
memcpy(src_in, src_addr, rdma_addr_size(src_addr));
- else
+ } else {
src_in->sa_family = dst_addr->sa_family;
+ }
return addr_resolve(src_in, dst_addr, addr, false);
}
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] IB/core: Allocating larger memory than required for cma_configfs
[not found] ` <1451484858-1530-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-30 14:14 ` [PATCH] IB/core: Eliminate sparse false positive warning on context imbalance Matan Barak
2015-12-30 14:14 ` [PATCH] IB/core: Fix dereference before check Matan Barak
@ 2015-12-31 7:50 ` Bart Van Assche
[not found] ` <5684DE5D.7040700-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2 siblings, 1 reply; 5+ messages in thread
From: Bart Van Assche @ 2015-12-31 7:50 UTC (permalink / raw)
To: Matan Barak, Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Majd Dibbiny, Moni Shoua
On 12/30/2015 03:14 PM, Matan Barak wrote:
> We were allocating larger memory space than requried for
> cma_dev_group->default_ports_group.
Please change the subject into something like "Do not allocate more
...". Please also fix the spelling error in the patch description.
Thanks,
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] IB/core: Allocating larger memory than required for cma_configfs
[not found] ` <5684DE5D.7040700-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
@ 2015-12-31 8:50 ` Matan Barak
0 siblings, 0 replies; 5+ messages in thread
From: Matan Barak @ 2015-12-31 8:50 UTC (permalink / raw)
To: Bart Van Assche
Cc: Matan Barak, Doug Ledford, linux-rdma, Or Gerlitz, Majd Dibbiny,
Moni Shoua
On Thu, Dec 31, 2015 at 9:50 AM, Bart Van Assche
<bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org> wrote:
> On 12/30/2015 03:14 PM, Matan Barak wrote:
>>
>> We were allocating larger memory space than requried for
>> cma_dev_group->default_ports_group.
>
>
> Please change the subject into something like "Do not allocate more ...".
> Please also fix the spelling error in the patch description.
>
No problem, I'll fix and send V1.
> Thanks,
>
> Bart.
>
Regards,
Matan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-31 8:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-30 14:14 [PATCH] IB/core: Allocating larger memory than required for cma_configfs Matan Barak
[not found] ` <1451484858-1530-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-30 14:14 ` [PATCH] IB/core: Eliminate sparse false positive warning on context imbalance Matan Barak
2015-12-30 14:14 ` [PATCH] IB/core: Fix dereference before check Matan Barak
2015-12-31 7:50 ` [PATCH] IB/core: Allocating larger memory than required for cma_configfs Bart Van Assche
[not found] ` <5684DE5D.7040700-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-12-31 8:50 ` Matan Barak
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.