LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Lior Dotan <liodot@gmail.com>
To: Jiri Slaby <jirislaby@gmail.com>, gregkh@suse.de
Cc: linux-kernel@vger.kernel.org, charrer@alacritech.com
Subject: Re: [STAGING] slicoss - use kzalloc
Date: Wed, 05 Nov 2008 11:52:17 +0200	[thread overview]
Message-ID: <49116CD1.7090907@gmail.com> (raw)
In-Reply-To: <491168DC.6070508@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 599 bytes --]

> On 11/05/2008 10:27 AM, Lior Dotan wrote:
>> This patch uses kzalloc() where really applicable.
> 
> ack this, but there is another problem.
> 
> sizeof(struct physcard *) is wrong size for that allocation, care to send a fix
> for this (and revice the rest of allocations)? I wonder how this could work with
Fix attached. I only found two other places with the same problem.

> SLAB_DEBUG on, maybe nobody tried...
AFAIK there aren't a lot of testers for this drivers so the few that 
does probably didn't try it.



Fix sizeof to use the right type

Signed-off-by: Lior Dotan <liodot@gmail.com>

[-- Attachment #2: slicoss-fix-sizeof.patch --]
[-- Type: text/plain, Size: 1190 bytes --]

--- b/drivers/staging/slicoss/slicoss.c	2008-11-05 11:39:42.017791088 +0200
+++ a/drivers/staging/slicoss/slicoss.c	2008-11-05 11:48:16.237808996 +0200
@@ -323,7 +323,7 @@ static void slic_init_adapter(struct net
 	index, pslic_handle, adapter->pfree_slic_handles, pslic_handle->next);*/
 	adapter->pshmem = (struct slic_shmem *)
 					pci_alloc_consistent(adapter->pcidev,
-					sizeof(struct slic_shmem *),
+					sizeof(struct slic_shmem),
 					&adapter->
 					phys_shmem);
 /*
@@ -1432,7 +1432,7 @@ static void slic_init_cleanup(struct ada
 		DBG_MSG("adapter[%p] port %d pshmem[%p] FreeShmem ",
 			adapter, adapter->port, (void *) adapter->pshmem);
 		pci_free_consistent(adapter->pcidev,
-				    sizeof(struct slic_shmem *),
+				    sizeof(struct slic_shmem),
 				    adapter->pshmem, adapter->phys_shmem);
 		adapter->pshmem = NULL;
 		adapter->phys_shmem = (dma_addr_t) NULL;
@@ -2833,7 +2833,7 @@ static u32 slic_card_locate(struct adapt
 	}
 	if (!physcard) {
 		/* no structure allocated for this physical card yet */
-		physcard = kzalloc(sizeof(struct physcard *), GFP_ATOMIC);
+		physcard = kzalloc(sizeof(struct physcard), GFP_ATOMIC);
 		ASSERT(physcard);
 
 		DBG_MSG

  reply	other threads:[~2008-11-05  9:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04 16:27 Lior Dotan
2008-11-04 22:01 ` Jiri Slaby
2008-11-05  9:27   ` Lior Dotan
2008-11-05  9:35     ` Jiri Slaby
2008-11-05  9:52       ` Lior Dotan [this message]
2008-11-08 14:18         ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49116CD1.7090907@gmail.com \
    --to=liodot@gmail.com \
    --cc=charrer@alacritech.com \
    --cc=gregkh@suse.de \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [STAGING] slicoss - use kzalloc' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).