From: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>, linuxppc-dev@lists.ozlabs.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
Thomas Huth <thuth@linux.vnet.ibm.com>
Subject: Re: [PATCH slof] helpers: Fix SLOF_alloc_mem_aligned to meet callers expectation
Date: Fri, 13 Mar 2015 14:25:36 +0530 [thread overview]
Message-ID: <87bnjxp987.fsf@abhimanyu.in.ibm.com> (raw)
In-Reply-To: <1426235812-3749-1-git-send-email-aik@ozlabs.ru>
Alexey Kardashevskiy <aik@ozlabs.ru> writes:
> Every caller of SLOF_alloc_mem_aligned() assumes the size is the first
> argument while it is not.
>
> This switches align and size and fixes random memory corruptions.
>
> This is grep for SLOF_alloc_mem_aligned with this patch applied:
>
> include/helpers.h|27| extern void *SLOF_alloc_mem_aligned(long size, long align);
> lib/libveth/veth.c|103| buffer_list = SLOF_alloc_mem_aligned(8192, 4096);
> lib/libveth/veth.c|105| rx_queue = SLOF_alloc_mem_aligned(rx_queue_len, 16);
> lib/libvirtio/virtio-net.c|101| vq[i].desc = SLOF_alloc_mem_aligned(virtio_vring_size(vq[i].size), 4096);
> slof/helpers.c|70| void *SLOF_alloc_mem_aligned(long size, long align)
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
> ---
> include/helpers.h | 2 +-
> slof/helpers.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/helpers.h b/include/helpers.h
> index f6d4375..fb10534 100644
> --- a/include/helpers.h
> +++ b/include/helpers.h
> @@ -24,7 +24,7 @@ extern void SLOF_usleep(uint32_t time);
> extern void *SLOF_dma_alloc(long size);
> extern void SLOF_dma_free(void *virt, long size);
> extern void *SLOF_alloc_mem(long size);
> -extern void *SLOF_alloc_mem_aligned(long align, long size);
> +extern void *SLOF_alloc_mem_aligned(long size, long align);
> extern void SLOF_free_mem(void *addr, long size);
> extern long SLOF_dma_map_in(void *virt, long size, int cacheable);
> extern void SLOF_dma_map_out(long phys, void *virt, long size);
> diff --git a/slof/helpers.c b/slof/helpers.c
> index c582996..d7c1888 100644
> --- a/slof/helpers.c
> +++ b/slof/helpers.c
> @@ -67,7 +67,7 @@ void *SLOF_alloc_mem(long size)
> return (void *)forth_pop();
> }
>
> -void *SLOF_alloc_mem_aligned(long align, long size)
> +void *SLOF_alloc_mem_aligned(long size, long align)
> {
> unsigned long addr = (unsigned long)SLOF_alloc_mem(size + align - 1);
> addr = addr + align - 1;
> --
> 2.0.0
prev parent reply other threads:[~2015-03-13 8:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-13 8:36 [PATCH slof] helpers: Fix SLOF_alloc_mem_aligned to meet callers expectation Alexey Kardashevskiy
2015-03-13 8:55 ` Nikunj A Dadhania [this message]
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=87bnjxp987.fsf@abhimanyu.in.ibm.com \
--to=nikunj@linux.vnet.ibm.com \
--cc=aik@ozlabs.ru \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=thuth@linux.vnet.ibm.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox