LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH][RFC] infiniband: Fix allocation size in register_snoop_agent()
@ 2011-02-11 21:43 Jesper Juhl
  2011-02-11 23:09 ` Hefty, Sean
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2011-02-11 21:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-rdma, Eli Cohen, Julia Lawall, Andrew Morton,
	Hal Rosenstock, Sean Hefty, Roland Dreier

Ok, someone needs to double check me on this before merging anything, but 
don't we want to allocate sizeof(struct ib_mad_snoop_private) here, rather 
than just the size of a pointer to the struct?

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 mad.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

 compile tested only. no hardware available for proper test.

diff --git 
a/drivers/infiniband/core/mad.c 
b/drivers/infiniband/core/mad.c
index 822cfdc..2c74b85 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -413,7 +413,7 @@ static int register_snoop_agent(struct ib_mad_qp_info *qp_info,
 	if (i == qp_info->snoop_table_size) {
 		/* Grow table. */
 		new_snoop_table = krealloc(qp_info->snoop_table,
-					   sizeof mad_snoop_priv *
+					   sizeof(struct ib_mad_snoop_private) *
 					   (qp_info->snoop_table_size + 1),
 					   GFP_ATOMIC);
 		if (!new_snoop_table) {


-- 
Jesper Juhl <jj@chaosbits.net>            http://www.chaosbits.net/
Plain text mails only, please.
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH][RFC] infiniband: Fix allocation size in register_snoop_agent()
  2011-02-11 21:43 [PATCH][RFC] infiniband: Fix allocation size in register_snoop_agent() Jesper Juhl
@ 2011-02-11 23:09 ` Hefty, Sean
  2011-02-13 20:19   ` Jesper Juhl
  0 siblings, 1 reply; 3+ messages in thread
From: Hefty, Sean @ 2011-02-11 23:09 UTC (permalink / raw)
  To: Jesper Juhl, linux-kernel
  Cc: linux-rdma, Eli Cohen, Julia Lawall, Andrew Morton,
	Hal Rosenstock, Roland Dreier

> Ok, someone needs to double check me on this before merging anything, but
> don't we want to allocate sizeof(struct ib_mad_snoop_private) here, rather
> than just the size of a pointer to the struct?

new_snoop_table is declared as:

struct ib_mad_snoop_private **new_snoop_table;

It should point to an array of pointers.

- Sean

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH][RFC] infiniband: Fix allocation size in register_snoop_agent()
  2011-02-11 23:09 ` Hefty, Sean
@ 2011-02-13 20:19   ` Jesper Juhl
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Juhl @ 2011-02-13 20:19 UTC (permalink / raw)
  To: Hefty, Sean
  Cc: linux-kernel, linux-rdma, Eli Cohen, Julia Lawall, Andrew Morton,
	Hal Rosenstock, Roland Dreier

On Fri, 11 Feb 2011, Hefty, Sean wrote:

> > Ok, someone needs to double check me on this before merging anything, but
> > don't we want to allocate sizeof(struct ib_mad_snoop_private) here, rather
> > than just the size of a pointer to the struct?
> 
> new_snoop_table is declared as:
> 
> struct ib_mad_snoop_private **new_snoop_table;
> 
> It should point to an array of pointers.
> 
Ok. Thank you for that reply.
Just ignore the patch then.

-- 
Jesper Juhl <jj@chaosbits.net>            http://www.chaosbits.net/
Plain text mails only, please.
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-13 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-11 21:43 [PATCH][RFC] infiniband: Fix allocation size in register_snoop_agent() Jesper Juhl
2011-02-11 23:09 ` Hefty, Sean
2011-02-13 20:19   ` Jesper Juhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).