All of lore.kernel.org
 help / color / mirror / Atom feed
* re: ieee802154: add extended address validation helper
@ 2014-11-03 20:41 Dan Carpenter
  2014-11-04  0:01 ` Alexander Aring
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2014-11-03 20:41 UTC (permalink / raw)
  To: alex.aring; +Cc: linux-wpan

Hello Alexander Aring,

The patch cb904b0a1630: "ieee802154: add extended address validation
helper" from Nov 2, 2014, leads to the following static checker
warning:

	include/linux/ieee802154.h:212 ieee802154_is_valid_extended_addr()
	warn: was && intended here instead of ||?

include/linux/ieee802154.h
   201  /**
   202   * ieee802154_is_valid_psdu_len - check if extended addr is valid
   203   * @addr: extended addr to check
   204   */
   205  static inline bool ieee802154_is_valid_extended_addr(const __le64 addr)
   206  {
   207          /* These EUI-64 addresses are reserved by IEEE. 0xffffffffffffffff
   208           * is used internally as extended to short address broadcast mapping.
   209           * This is currently a workaround because neighbor discovery can't
   210           * deal with short addresses types right now.
   211           */
   212          return ((addr != cpu_to_le64(0x0000000000000000ULL)) ||
   213                  (addr != cpu_to_le64(0xffffffffffffffffULL)));

The current code always returns true.  It looks like the static checker
suggestion of change || to && is the correct fix?

   214  }

regards,
dan carpenter

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

* Re: ieee802154: add extended address validation helper
  2014-11-03 20:41 ieee802154: add extended address validation helper Dan Carpenter
@ 2014-11-04  0:01 ` Alexander Aring
  2014-11-04  8:55   ` [patch] ieee802154: || vs && in ieee802154_is_valid_extended_addr() Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Aring @ 2014-11-04  0:01 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-wpan

Hi Dan Carpenter,

On Mon, Nov 03, 2014 at 11:41:13PM +0300, Dan Carpenter wrote:
> Hello Alexander Aring,
> 
> The patch cb904b0a1630: "ieee802154: add extended address validation
> helper" from Nov 2, 2014, leads to the following static checker
> warning:
> 
> 	include/linux/ieee802154.h:212 ieee802154_is_valid_extended_addr()
> 	warn: was && intended here instead of ||?
> 
> include/linux/ieee802154.h
>    201  /**
>    202   * ieee802154_is_valid_psdu_len - check if extended addr is valid
>    203   * @addr: extended addr to check
>    204   */
>    205  static inline bool ieee802154_is_valid_extended_addr(const __le64 addr)
>    206  {
>    207          /* These EUI-64 addresses are reserved by IEEE. 0xffffffffffffffff
>    208           * is used internally as extended to short address broadcast mapping.
>    209           * This is currently a workaround because neighbor discovery can't
>    210           * deal with short addresses types right now.
>    211           */
>    212          return ((addr != cpu_to_le64(0x0000000000000000ULL)) ||
>    213                  (addr != cpu_to_le64(0xffffffffffffffffULL)));
> 
> The current code always returns true.  It looks like the static checker
> suggestion of change || to && is the correct fix?
> 

yes, you are right. Thanks for the suggestion. Do you want to fix that
and send a patch based on bluetooth-next or should I queue this for my
next series?

- Alex

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

* [patch] ieee802154: || vs && in ieee802154_is_valid_extended_addr()
  2014-11-04  0:01 ` Alexander Aring
@ 2014-11-04  8:55   ` Dan Carpenter
  2014-11-04  9:12     ` Alexander Aring
  2014-11-04 16:45     ` Marcel Holtmann
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2014-11-04  8:55 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-wpan

The ieee802154_is_valid_extended_addr() always returns true because
there is a typo.  The || should be &&.  Neither 0x0000000000000000ULL
nor 0xffffffffffffffffULL are valid addresses.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
index 5d9e745..4c03286 100644
--- a/include/linux/ieee802154.h
+++ b/include/linux/ieee802154.h
@@ -209,7 +209,7 @@ static inline bool ieee802154_is_valid_extended_addr(const __le64 addr)
 	 * This is currently a workaround because neighbor discovery can't
 	 * deal with short addresses types right now.
 	 */
-	return ((addr != cpu_to_le64(0x0000000000000000ULL)) ||
+	return ((addr != cpu_to_le64(0x0000000000000000ULL)) &&
 		(addr != cpu_to_le64(0xffffffffffffffffULL)));
 }
 

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

* Re: [patch] ieee802154: || vs && in ieee802154_is_valid_extended_addr()
  2014-11-04  8:55   ` [patch] ieee802154: || vs && in ieee802154_is_valid_extended_addr() Dan Carpenter
@ 2014-11-04  9:12     ` Alexander Aring
  2014-11-04 16:45     ` Marcel Holtmann
  1 sibling, 0 replies; 5+ messages in thread
From: Alexander Aring @ 2014-11-04  9:12 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-wpan

On Tue, Nov 04, 2014 at 11:55:09AM +0300, Dan Carpenter wrote:
> The ieee802154_is_valid_extended_addr() always returns true because
> there is a typo.  The || should be &&.  Neither 0x0000000000000000ULL
> nor 0xffffffffffffffffULL are valid addresses.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Alexander Aring <alex.aring@gmail.com>

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

* Re: [patch] ieee802154: || vs && in ieee802154_is_valid_extended_addr()
  2014-11-04  8:55   ` [patch] ieee802154: || vs && in ieee802154_is_valid_extended_addr() Dan Carpenter
  2014-11-04  9:12     ` Alexander Aring
@ 2014-11-04 16:45     ` Marcel Holtmann
  1 sibling, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2014-11-04 16:45 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Alexander Aring, linux-wpan

Hi Dan,

> The ieee802154_is_valid_extended_addr() always returns true because
> there is a typo.  The || should be &&.  Neither 0x0000000000000000ULL
> nor 0xffffffffffffffffULL are valid addresses.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2014-11-04 16:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-03 20:41 ieee802154: add extended address validation helper Dan Carpenter
2014-11-04  0:01 ` Alexander Aring
2014-11-04  8:55   ` [patch] ieee802154: || vs && in ieee802154_is_valid_extended_addr() Dan Carpenter
2014-11-04  9:12     ` Alexander Aring
2014-11-04 16:45     ` Marcel Holtmann

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.