lkml.org 
[lkml]   [2008]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [STAGING] slicoss - use kzalloc
    > 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>
    --- 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
    \
     
     \ /
      Last update: 2008-11-05 10:55    [W:0.023 / U:120.908 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site