mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM: Wrong size used in dump_mem()
Date: Thu, 17 Dec 2009 21:17:59 +0000	[thread overview]
Message-ID: <20091217211759.GB16520@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <4B2A9F8E.5080508@gmail.com>

On Thu, Dec 17, 2009 at 10:15:58PM +0100, Roel Kluin wrote:
> The sizeof the pointed to should be used rather than of the pointer
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Unless I am mistaken?

You are mistaken.  sizeof(array) is the byte size of the array.
sizeof(*array) is the size of one individual object of the array.

The code is correct as is - which is to fill  the entire array with
space characters and then zero the last one.

> diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
> index 3f361a7..5e828fa 100644
> --- a/arch/arm/kernel/traps.c
> +++ b/arch/arm/kernel/traps.c
> @@ -102,7 +102,7 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
>  		unsigned long p;
>  		char str[sizeof(" 12345678") * 8 + 1];
>  
> -		memset(str, ' ', sizeof(str));
> +		memset(str, ' ', sizeof(*str));
>  		str[sizeof(str) - 1] = '\0';
>  
>  		for (p = first, i = 0; i < 8 && p < top; i++, p += 4) {

  reply	other threads:[~2009-12-17 21:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-17 21:15 Roel Kluin
2009-12-17 21:17 ` Russell King - ARM Linux [this message]
2009-12-17 21:20   ` roel kluin

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=20091217211759.GB16520@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roel.kluin@gmail.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

all inboxes | Powered by JetHome®