mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Giangiacomo Mariotti" <giangiacomo.mariotti@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Misuse of sizeof
Date: Sat, 13 Dec 2008 17:31:06 +0100	[thread overview]
Message-ID: <2aac3c260812130831m3ec4aa5cm3abd729499727873@mail.gmail.com> (raw)

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

IMO there's a bug in the use of sizeof in /arch/x86/boot/main.c, it's
also a strange style.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-misuse-of-sizeof.patch --]
[-- Type: text/x-patch; name=0001-misuse-of-sizeof.patch, Size: 844 bytes --]

From 473bf306f25b05b1516164cbbf7bd0831133275a Mon Sep 17 00:00:00 2001
From: MisterIO <mrio@debian-hell.inferis.org>
Date: Sat, 13 Dec 2008 17:19:27 +0100
Subject: [PATCH] misuse of sizeof

---
 arch/x86/boot/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c
index 197421d..ecd87cf 100644
--- a/arch/x86/boot/main.c
+++ b/arch/x86/boot/main.c
@@ -34,8 +34,8 @@ static void copy_boot_params(void)
 	const struct old_cmdline * const oldcmd =
 		(const struct old_cmdline *)OLD_CL_ADDRESS;
 
-	BUILD_BUG_ON(sizeof boot_params != 4096);
-	memcpy(&boot_params.hdr, &hdr, sizeof hdr);
+	BUILD_BUG_ON(sizeof(boot_params) != 4096);
+	memcpy(&boot_params.hdr, &hdr, sizeof(hdr));
 
 	if (!boot_params.hdr.cmd_line_ptr &&
 	    oldcmd->cl_magic == OLD_CL_MAGIC) {
-- 
1.6.0.4


             reply	other threads:[~2008-12-13 16:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-13 16:31 Giangiacomo Mariotti [this message]
2008-12-13 16:43 ` Frédéric Weisbecker
2008-12-13 17:33   ` Giangiacomo Mariotti
2008-12-13 16:44 ` Miguel Ojeda
2008-12-13 16:48 ` Gregory Petrosyan
2008-12-13 16:59 ` Roland Dreier

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=2aac3c260812130831m3ec4aa5cm3abd729499727873@mail.gmail.com \
    --to=giangiacomo.mariotti@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®