All of lore.kernel.org
 help / color / mirror / Atom feed
* Misleading messages from match 0.6.1-rc1
@ 2020-02-05  6:51 Toomas Soome
  2020-02-05  7:05 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Toomas Soome @ 2020-02-05  6:51 UTC (permalink / raw)
  To: smatch


Hi!

While checking illumos soource, smatch is reporting:

/code/illumos-gate/usr/src/tools/proto/root_sparc-nd/opt/onbld/bin/sparc/smatch: ../../common/fs/ufs/ufs_vnops.c:737 wrip() warn: subtract is higher precedence than shift

The code is:

http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/fs/ufs/ufs_vnops.c#737

limit = MIN(UFS_MAXOFFSET_T, limit);

Where MIN is defined:

#define	MIN(a, b)	((a) < (b) ? (a) : (b))

As seen from those facts, we have no subtraction nor shift. In code above, limit is unsigned 64-bit, UFS_MAXOFFSET_T is signed.


rgds,
Toomas

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

* Re: Misleading messages from match 0.6.1-rc1
  2020-02-05  6:51 Misleading messages from match 0.6.1-rc1 Toomas Soome
@ 2020-02-05  7:05 ` Dan Carpenter
  2020-02-05  8:07   ` Toomas Soome
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2020-02-05  7:05 UTC (permalink / raw)
  To: Toomas Soome; +Cc: smatch

On Wed, Feb 05, 2020 at 08:51:11AM +0200, Toomas Soome wrote:
> 
> Hi!
> 
> While checking illumos soource, smatch is reporting:
> 
> /code/illumos-gate/usr/src/tools/proto/root_sparc-nd/opt/onbld/bin/sparc/smatch: ../../common/fs/ufs/ufs_vnops.c:737 wrip() warn: subtract is higher precedence than shift
> 
> The code is:
> 
> http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/fs/ufs/ufs_vnops.c#737
> 
> limit = MIN(UFS_MAXOFFSET_T, limit);
> 
> Where MIN is defined:
> 
> #define	MIN(a, b)	((a) < (b) ? (a) : (b))
> 
> As seen from those facts, we have no subtraction nor shift. In code above, limit is unsigned 64-bit, UFS_MAXOFFSET_T is signed.
> 

It's complaining about UFS_MAXOFFSET_T.

#define	UFS_MAXOFFSET_T	((1LL << NBBY * sizeof (daddr32_t) + DEV_BSHIFT - 1) \
							- 1)

I assume the code is correct but adding parenthese around the
(DEV_BSHIFT - 1) doesn't help explain where the minus one comes from.

regards,
dan carpenter

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

* Re: Misleading messages from match 0.6.1-rc1
  2020-02-05  7:05 ` Dan Carpenter
@ 2020-02-05  8:07   ` Toomas Soome
  0 siblings, 0 replies; 3+ messages in thread
From: Toomas Soome @ 2020-02-05  8:07 UTC (permalink / raw)
  To: smatch



> On 5. Feb 2020, at 09:05, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> On Wed, Feb 05, 2020 at 08:51:11AM +0200, Toomas Soome wrote:
>> 
>> Hi!
>> 
>> While checking illumos soource, smatch is reporting:
>> 
>> /code/illumos-gate/usr/src/tools/proto/root_sparc-nd/opt/onbld/bin/sparc/smatch: ../../common/fs/ufs/ufs_vnops.c:737 wrip() warn: subtract is higher precedence than shift
>> 
>> The code is:
>> 
>> http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/fs/ufs/ufs_vnops.c#737
>> 
>> limit = MIN(UFS_MAXOFFSET_T, limit);
>> 
>> Where MIN is defined:
>> 
>> #define	MIN(a, b)	((a) < (b) ? (a) : (b))
>> 
>> As seen from those facts, we have no subtraction nor shift. In code above, limit is unsigned 64-bit, UFS_MAXOFFSET_T is signed.
>> 
> 
> It's complaining about UFS_MAXOFFSET_T.
> 
> #define	UFS_MAXOFFSET_T	((1LL << NBBY * sizeof (daddr32_t) + DEV_BSHIFT - 1) \
> 							- 1)
> 
> I assume the code is correct but adding parenthese around the
> (DEV_BSHIFT - 1) doesn't help explain where the minus one comes from.
> 
> regards,
> dan carpenter

Oh, it is my oversight, totally missed the alternate define. That case is actually (1 << 40) - 1 and indeed, the warning is to tell us that we might use () around the right side of << operator.

Thanks,
Toomas

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

end of thread, other threads:[~2020-02-05  8:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05  6:51 Misleading messages from match 0.6.1-rc1 Toomas Soome
2020-02-05  7:05 ` Dan Carpenter
2020-02-05  8:07   ` Toomas Soome

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.