From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] cmd_nand: Fix warning: dereferencing type-punned pointer will break strict-aliasing rules
Date: Wed, 2 Apr 2008 16:50:12 +0200 [thread overview]
Message-ID: <20080402145012.GA18098@game.jcrosoft.org> (raw)
In-Reply-To: <20080402143919.B479F2476E@gemini.denx.de>
On 16:39 Wed 02 Apr , Wolfgang Denk wrote:
> In message <1207136270-19315-1-git-send-email-plagnioj@jcrosoft.com> you wrote:
> > cmd_nand.c:353: warning: dereferencing type-punned pointer will break strict-aliasing rules
> > cmd_nand.c:356: warning: dereferencing type-punned pointer will break strict-aliasing rules
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> >
> > diff --git a/common/cmd_nand.c b/common/cmd_nand.c
> > index 7b1f830..2906aed 100644
> > --- a/common/cmd_nand.c
> > +++ b/common/cmd_nand.c
> > @@ -84,7 +84,7 @@ static int nand_dump(nand_info_t *nand, ulong off)
> >
> > /* ------------------------------------------------------------------------- */
> >
> > -static inline int str2long(char *p, ulong *num)
> > +static inline int str2long(char *p, loff_t *num)
>
> I think this is plain wrong. It may silence the warning, but it is
> wrong.
>
> The type is the result of calling simple_strtoul(), and this function
> returns, um, and unsigned long. And not an offset type.
I agree
>
> > -arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, ulong *size)
> > +arg_off_size(int argc, char *argv[], nand_info_t *nand, loff_t *off, size_t *size)
>
> No. That's all wrong.
I disagree, the true type of the offest is loff_t and size is size_t in
the linux/mtd.
Maybe we need to do the cast to ulong in this function.
Best Regards,
J.
next prev parent reply other threads:[~2008-04-02 14:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-02 6:03 [U-Boot-Users] [PATCH 0/2] MPC8xx: Fix libfdt support introduced in commit 77ff7b74 Jean-Christophe PLAGNIOL-VILLARD
2008-04-02 6:03 ` [U-Boot-Users] [PATCH 1/2] cmd_log.c: Fix assignment differ in signedness Jean-Christophe PLAGNIOL-VILLARD
2008-04-02 6:03 ` [U-Boot-Users] [PATCH 2/2] ds174x: Fix warning on return in rtc_get and rtc_set function Jean-Christophe PLAGNIOL-VILLARD
2008-04-02 11:37 ` [U-Boot-Users] [PATCH] cmd_nand: Fix warning: dereferencing type-punned pointer will break strict-aliasing rules Jean-Christophe PLAGNIOL-VILLARD
2008-04-02 11:41 ` [U-Boot-Users] [PATCH] mpc837xerdb: Fix warning: implicit declaration of function 'fdt_fixup_dr_usb' Jean-Christophe PLAGNIOL-VILLARD
2008-04-02 17:50 ` Kim Phillips
2008-04-08 14:40 ` [U-Boot-Users] unassigned-patches/13: " u-boot at bugs.denx.de
2008-04-02 14:34 ` [U-Boot-Users] [PATCH] cmd_nand: Fix warning: dereferencing type-punned pointer will break strict-aliasing rules Stefan Roese
2008-04-02 14:39 ` Wolfgang Denk
2008-04-02 14:50 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2008-04-08 14:40 ` [U-Boot-Users] unassigned-patches/11: " u-boot at bugs.denx.de
2008-04-08 20:49 ` [U-Boot-Users] [U-boot] " Wolfgang Denk
2008-04-08 14:40 ` [U-Boot-Users] unassigned-patches/12: [PATCH 2/2] ds174x: Fix warning on return in rtc_get and rtc_set function u-boot at bugs.denx.de
2008-04-08 21:01 ` [U-Boot-Users] [U-boot] " Wolfgang Denk
2008-04-09 8:46 ` Jean-Christophe PLAGNIOL-VILLARD
2008-04-09 10:42 ` Wolfgang Denk
2008-04-18 4:14 ` [U-Boot-Users] " Wolfgang Denk
2008-04-08 14:40 ` [U-Boot-Users] unassigned-patches/10: [PATCH 1/2] cmd_log.c: Fix assignment differ in signedness u-boot at bugs.denx.de
2008-04-18 4:14 ` [U-Boot-Users] " Wolfgang Denk
2008-04-02 12:11 ` [U-Boot-Users] [PATCH 0/2] MPC8xx: Fix libfdt support introduced in commit 77ff7b74 Jerry Van Baren
2008-04-08 14:40 ` [U-Boot-Users] unassigned-patches/9: " u-boot at bugs.denx.de
2008-04-08 20:47 ` [U-Boot-Users] [U-boot] " Wolfgang Denk
2008-04-09 0:04 ` Jerry Van Baren
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=20080402145012.GA18098@game.jcrosoft.org \
--to=plagnioj@jcrosoft.com \
--cc=u-boot@lists.denx.de \
/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