public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* mtd-utils-1.5.1 bug report
@ 2014-09-07 14:58 David Binderman
  2014-09-08 11:50 ` Artem Bityutskiy
  2014-09-08 12:09 ` Artem Bityutskiy
  0 siblings, 2 replies; 4+ messages in thread
From: David Binderman @ 2014-09-07 14:58 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org

Hello there,

ubi-utils/ubiformat.c:636:28: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]

                if (!args.subpage_size != mtd->min_io_size)
                    normsg("may be sub-page size is "
                           "incorrect?");

Something boolean compared to a size. Looks a possible problem to me.
Removal of the double negative might also help.

Regards

David Binderman

 		 	   		  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: mtd-utils-1.5.1 bug report
  2014-09-07 14:58 mtd-utils-1.5.1 bug report David Binderman
@ 2014-09-08 11:50 ` Artem Bityutskiy
  2014-09-08 12:09 ` Artem Bityutskiy
  1 sibling, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2014-09-08 11:50 UTC (permalink / raw)
  To: David Binderman; +Cc: linux-mtd@lists.infradead.org

On Sun, 2014-09-07 at 14:58 +0000, David Binderman wrote:
> Hello there,
> 
> ubi-utils/ubiformat.c:636:28: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
> 
>                 if (!args.subpage_size != mtd->min_io_size)
>                     normsg("may be sub-page size is "
>                            "incorrect?");
> 
> Something boolean compared to a size. Looks a possible problem to me.
> Removal of the double negative might also help.

Care to send a patch?

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: mtd-utils-1.5.1 bug report
  2014-09-07 14:58 mtd-utils-1.5.1 bug report David Binderman
  2014-09-08 11:50 ` Artem Bityutskiy
@ 2014-09-08 12:09 ` Artem Bityutskiy
  2014-09-16 15:13   ` Artem Bityutskiy
  1 sibling, 1 reply; 4+ messages in thread
From: Artem Bityutskiy @ 2014-09-08 12:09 UTC (permalink / raw)
  To: David Binderman; +Cc: linux-mtd@lists.infradead.org

On Sun, 2014-09-07 at 14:58 +0000, David Binderman wrote:
> Hello there,
> 
> ubi-utils/ubiformat.c:636:28: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
> 
>                 if (!args.subpage_size != mtd->min_io_size)
>                     normsg("may be sub-page size is "
>                            "incorrect?");

Hi,

I'd propose this patch to fix the issue:

Subject: [PATCH] ubiformat: fix the subpage size hint on the error path

David Binderman <dcb314@hotmail.com> reports that the following piece of looks
wrong:

if (!args.subpage_size != mtd->min_io_size)
    normsg("may be sub-page size is incorrect?");

I totally agree with him and I believe that we actually meant to have no
negation in fron to f 'args.subpage_size', so instead, the code should look
like this:

if (args.subpage_size != mtd->min_io_size)
    normsg("may be sub-page size is incorrect?");

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
 ubi-utils/ubiformat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c
index 1b8f6fb..21409ca 100644
--- a/ubi-utils/ubiformat.c
+++ b/ubi-utils/ubiformat.c
@@ -633,9 +633,8 @@ static int format(libmtd_t libmtd, const struct mtd_dev_info *mtd,
                                   write_size, eb);
 
                        if (errno != EIO) {
-                               if (!args.subpage_size != mtd->min_io_size)
-                                       normsg("may be sub-page size is "
-                                              "incorrect?");
+                               if (args.subpage_size != mtd->min_io_size)
+                                       normsg("may be sub-page size is incorrect?");
                                goto out_free;
                        }
 
-- 
1.9.3

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: mtd-utils-1.5.1 bug report
  2014-09-08 12:09 ` Artem Bityutskiy
@ 2014-09-16 15:13   ` Artem Bityutskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2014-09-16 15:13 UTC (permalink / raw)
  To: David Binderman; +Cc: linux-mtd@lists.infradead.org

On Mon, 2014-09-08 at 15:09 +0300, Artem Bityutskiy wrote:
> On Sun, 2014-09-07 at 14:58 +0000, David Binderman wrote:
> > Hello there,
> > 
> > ubi-utils/ubiformat.c:636:28: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
> > 
> >                 if (!args.subpage_size != mtd->min_io_size)
> >                     normsg("may be sub-page size is "
> >                            "incorrect?");
> 
> Hi,
> 
> I'd propose this patch to fix the issue:
> 
> Subject: [PATCH] ubiformat: fix the subpage size hint on the error path

I've just pushed this patch to mtd-utils.git. I did not test it, but
hopefully it is trivial enough and not so risky since it changes the
error path.

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-16 15:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-07 14:58 mtd-utils-1.5.1 bug report David Binderman
2014-09-08 11:50 ` Artem Bityutskiy
2014-09-08 12:09 ` Artem Bityutskiy
2014-09-16 15:13   ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox