* [patch] net/mlx4: && vs & typo
@ 2017-02-28 12:02 ` Dan Carpenter
0 siblings, 0 replies; 17+ messages in thread
From: Dan Carpenter @ 2017-02-28 12:02 UTC (permalink / raw)
To: Yishai Hadas, Eugenia Emantayev
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
Bitwise & was obviously intended here.
Fixes: 745d8ae4622c ("net/mlx4: Spoofcheck and zero MAC can't coexist")
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
Applies to net.git.
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index e965e5090d96..a858bcb6220b 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -109,7 +109,7 @@ static inline void mlx4_u64_to_mac(u8 *addr, u64 mac)
int i;
for (i = ETH_ALEN; i > 0; i--) {
- addr[i - 1] = mac && 0xFF;
+ addr[i - 1] = mac & 0xFF;
mac >>= 8;
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [patch] net/mlx4: && vs & typo
@ 2017-02-28 12:02 ` Dan Carpenter
0 siblings, 0 replies; 17+ messages in thread
From: Dan Carpenter @ 2017-02-28 12:02 UTC (permalink / raw)
To: Yishai Hadas, Eugenia Emantayev
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
Bitwise & was obviously intended here.
Fixes: 745d8ae4622c ("net/mlx4: Spoofcheck and zero MAC can't coexist")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Applies to net.git.
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index e965e5090d96..a858bcb6220b 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -109,7 +109,7 @@ static inline void mlx4_u64_to_mac(u8 *addr, u64 mac)
int i;
for (i = ETH_ALEN; i > 0; i--) {
- addr[i - 1] = mac && 0xFF;
+ addr[i - 1] = mac & 0xFF;
mac >>= 8;
}
}
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
2017-02-28 12:02 ` Dan Carpenter
@ 2017-02-28 15:35 ` Bart Van Assche
-1 siblings, 0 replies; 17+ messages in thread
From: Bart Van Assche @ 2017-02-28 15:35 UTC (permalink / raw)
To: eugenia-VPRAkNaXOzVWk0Htik3J/w,
dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
yishaih-VPRAkNaXOzVWk0Htik3J/w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On Tue, 2017-02-28 at 15:02 +0300, Dan Carpenter wrote:
> Bitwise & was obviously intended here.
>
> Fixes: 745d8ae4622c ("net/mlx4: Spoofcheck and zero MAC can't coexist")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Applies to net.git.
>
> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
> index e965e5090d96..a858bcb6220b 100644
> --- a/include/linux/mlx4/driver.h
> +++ b/include/linux/mlx4/driver.h
> @@ -109,7 +109,7 @@ static inline void mlx4_u64_to_mac(u8 *addr, u64 mac)
> int i;
>
> for (i = ETH_ALEN; i > 0; i--) {
> - addr[i - 1] = mac && 0xFF;
> + addr[i - 1] = mac & 0xFF;
> mac >>= 8;
> }
> }
Is this the only place where such a loop occurs? Should a put_unaligned_be48()
function be introduced?
Bart.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
@ 2017-02-28 15:35 ` Bart Van Assche
0 siblings, 0 replies; 17+ messages in thread
From: Bart Van Assche @ 2017-02-28 15:35 UTC (permalink / raw)
To: eugenia-VPRAkNaXOzVWk0Htik3J/w,
dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
yishaih-VPRAkNaXOzVWk0Htik3J/w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
T24gVHVlLCAyMDE3LTAyLTI4IGF0IDE1OjAyICswMzAwLCBEYW4gQ2FycGVudGVyIHdyb3RlOg0K
PiBCaXR3aXNlICYgd2FzIG9idmlvdXNseSBpbnRlbmRlZCBoZXJlLg0KPiANCj4gRml4ZXM6IDc0
NWQ4YWU0NjIyYyAoIm5ldC9tbHg0OiBTcG9vZmNoZWNrIGFuZCB6ZXJvIE1BQyBjYW4ndCBjb2V4
aXN0IikNCj4gU2lnbmVkLW9mZi1ieTogRGFuIENhcnBlbnRlciA8ZGFuLmNhcnBlbnRlckBvcmFj
bGUuY29tPg0KPiAtLS0NCj4gQXBwbGllcyB0byBuZXQuZ2l0Lg0KPiANCj4gZGlmZiAtLWdpdCBh
L2luY2x1ZGUvbGludXgvbWx4NC9kcml2ZXIuaCBiL2luY2x1ZGUvbGludXgvbWx4NC9kcml2ZXIu
aA0KPiBpbmRleCBlOTY1ZTUwOTBkOTYuLmE4NThiY2I2MjIwYiAxMDA2NDQNCj4gLS0tIGEvaW5j
bHVkZS9saW51eC9tbHg0L2RyaXZlci5oDQo+ICsrKyBiL2luY2x1ZGUvbGludXgvbWx4NC9kcml2
ZXIuaA0KPiBAQCAtMTA5LDcgKzEwOSw3IEBAIHN0YXRpYyBpbmxpbmUgdm9pZCBtbHg0X3U2NF90
b19tYWModTggKmFkZHIsIHU2NCBtYWMpDQo+ICAJaW50IGk7DQo+ICANCj4gIAlmb3IgKGkgPSBF
VEhfQUxFTjsgaSA+IDA7IGktLSkgew0KPiAtCQlhZGRyW2kgLSAxXSA9IG1hYyAmJiAweEZGOw0K
PiArCQlhZGRyW2kgLSAxXSA9IG1hYyAmIDB4RkY7DQo+ICAJCW1hYyA+Pj0gODsNCj4gIAl9DQo+
ICB9DQoNCklzIHRoaXMgdGhlIG9ubHkgcGxhY2Ugd2hlcmUgc3VjaCBhIGxvb3Agb2NjdXJzPyBT
aG91bGQgYSBwdXRfdW5hbGlnbmVkX2JlNDgoKQ0KZnVuY3Rpb24gYmUgaW50cm9kdWNlZD8NCg0K
QmFydC4
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
2017-02-28 12:02 ` Dan Carpenter
(?)
@ 2017-02-28 16:53 ` Tariq Toukan
-1 siblings, 0 replies; 17+ messages in thread
From: Tariq Toukan @ 2017-02-28 16:53 UTC (permalink / raw)
To: Dan Carpenter, Yishai Hadas, Eugenia Emantayev
Cc: linux-rdma, netdev, kernel-janitors
On 28/02/2017 2:02 PM, Dan Carpenter wrote:
> Bitwise & was obviously intended here.
Sure! Thanks for your patch.
>
> Fixes: 745d8ae4622c ("net/mlx4: Spoofcheck and zero MAC can't coexist")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Applies to net.git.
>
> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
> index e965e5090d96..a858bcb6220b 100644
> --- a/include/linux/mlx4/driver.h
> +++ b/include/linux/mlx4/driver.h
> @@ -109,7 +109,7 @@ static inline void mlx4_u64_to_mac(u8 *addr, u64 mac)
> int i;
>
> for (i = ETH_ALEN; i > 0; i--) {
> - addr[i - 1] = mac && 0xFF;
> + addr[i - 1] = mac & 0xFF;
> mac >>= 8;
> }
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
@ 2017-02-28 16:53 ` Tariq Toukan
0 siblings, 0 replies; 17+ messages in thread
From: Tariq Toukan @ 2017-02-28 16:53 UTC (permalink / raw)
To: Dan Carpenter, Yishai Hadas, Eugenia Emantayev
Cc: linux-rdma, netdev, kernel-janitors
On 28/02/2017 2:02 PM, Dan Carpenter wrote:
> Bitwise & was obviously intended here.
Sure! Thanks for your patch.
>
> Fixes: 745d8ae4622c ("net/mlx4: Spoofcheck and zero MAC can't coexist")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Applies to net.git.
>
> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
> index e965e5090d96..a858bcb6220b 100644
> --- a/include/linux/mlx4/driver.h
> +++ b/include/linux/mlx4/driver.h
> @@ -109,7 +109,7 @@ static inline void mlx4_u64_to_mac(u8 *addr, u64 mac)
> int i;
>
> for (i = ETH_ALEN; i > 0; i--) {
> - addr[i - 1] = mac && 0xFF;
> + addr[i - 1] = mac & 0xFF;
> mac >>= 8;
> }
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
@ 2017-02-28 16:53 ` Tariq Toukan
0 siblings, 0 replies; 17+ messages in thread
From: Tariq Toukan @ 2017-02-28 16:53 UTC (permalink / raw)
To: Dan Carpenter, Yishai Hadas, Eugenia Emantayev
Cc: linux-rdma, netdev, kernel-janitors
On 28/02/2017 2:02 PM, Dan Carpenter wrote:
> Bitwise & was obviously intended here.
Sure! Thanks for your patch.
>
> Fixes: 745d8ae4622c ("net/mlx4: Spoofcheck and zero MAC can't coexist")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Applies to net.git.
>
> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
> index e965e5090d96..a858bcb6220b 100644
> --- a/include/linux/mlx4/driver.h
> +++ b/include/linux/mlx4/driver.h
> @@ -109,7 +109,7 @@ static inline void mlx4_u64_to_mac(u8 *addr, u64 mac)
> int i;
>
> for (i = ETH_ALEN; i > 0; i--) {
> - addr[i - 1] = mac && 0xFF;
> + addr[i - 1] = mac & 0xFF;
> mac >>= 8;
> }
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
[not found] ` <1488296129.3056.1.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
@ 2017-02-28 22:23 ` Joe Perches
0 siblings, 0 replies; 17+ messages in thread
From: Joe Perches @ 2017-02-28 22:23 UTC (permalink / raw)
To: Bart Van Assche, eugenia-VPRAkNaXOzVWk0Htik3J/w,
dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
yishaih-VPRAkNaXOzVWk0Htik3J/w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On Tue, 2017-02-28 at 15:35 +0000, Bart Van Assche wrote:
> On Tue, 2017-02-28 at 15:02 +0300, Dan Carpenter wrote:
> > Bitwise & was obviously intended here.
[]
> > diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
[]
> > @@ -109,7 +109,7 @@ static inline void (u8 *addr, u64 mac)
> > int i;
> >
> > for (i = ETH_ALEN; i > 0; i--) {
> > - addr[i - 1] = mac && 0xFF;
> > + addr[i - 1] = mac & 0xFF;
> > mac >>= 8;
> > }
> > }
>
> Is this the only place where such a loop occurs?
Seems to be.
> Should a put_unaligned_be48()
> function be introduced?
Why? This is used exactly once.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
@ 2017-02-28 22:23 ` Joe Perches
0 siblings, 0 replies; 17+ messages in thread
From: Joe Perches @ 2017-02-28 22:23 UTC (permalink / raw)
To: Bart Van Assche, eugenia-VPRAkNaXOzVWk0Htik3J/w,
dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
yishaih-VPRAkNaXOzVWk0Htik3J/w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On Tue, 2017-02-28 at 15:35 +0000, Bart Van Assche wrote:
> On Tue, 2017-02-28 at 15:02 +0300, Dan Carpenter wrote:
> > Bitwise & was obviously intended here.
[]
> > diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
[]
> > @@ -109,7 +109,7 @@ static inline void (u8 *addr, u64 mac)
> > int i;
> >
> > for (i = ETH_ALEN; i > 0; i--) {
> > - addr[i - 1] = mac && 0xFF;
> > + addr[i - 1] = mac & 0xFF;
> > mac >>= 8;
> > }
> > }
>
> Is this the only place where such a loop occurs?
Seems to be.
> Should a put_unaligned_be48()
> function be introduced?
Why? This is used exactly once.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
2017-02-28 22:23 ` Joe Perches
@ 2017-02-28 22:45 ` Bart Van Assche
-1 siblings, 0 replies; 17+ messages in thread
From: Bart Van Assche @ 2017-02-28 22:45 UTC (permalink / raw)
To: Joe Perches, eugenia-VPRAkNaXOzVWk0Htik3J/w,
dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
yishaih-VPRAkNaXOzVWk0Htik3J/w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On 02/28/2017 02:23 PM, Joe Perches wrote:
> On Tue, 2017-02-28 at 15:35 +0000, Bart Van Assche wrote:
>> On Tue, 2017-02-28 at 15:02 +0300, Dan Carpenter wrote:
>>> Bitwise & was obviously intended here.
> []
>>> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
> []
>>> @@ -109,7 +109,7 @@ static inline void (u8 *addr, u64 mac)
>>> int i;
>>>
>>> for (i = ETH_ALEN; i > 0; i--) {
>>> - addr[i - 1] = mac && 0xFF;
>>> + addr[i - 1] = mac & 0xFF;
>>> mac >>= 8;
>>> }
>>> }
>>
>> Is this the only place where such a loop occurs?
>
> Seems to be.
>
>> Should a put_unaligned_be48()
>> function be introduced?
>
> Why? This is used exactly once.
Really? Here is an example of another open-coded version of
put_unaligned_be48() from arch/mips/cavium-octeon/octeon-platform.c:
new_mac[0] = (mac >> 40) & 0xff;
new_mac[1] = (mac >> 32) & 0xff;
new_mac[2] = (mac >> 24) & 0xff;
new_mac[3] = (mac >> 16) & 0xff;
new_mac[4] = (mac >> 8) & 0xff;
new_mac[5] = mac & 0xff;
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
@ 2017-02-28 22:45 ` Bart Van Assche
0 siblings, 0 replies; 17+ messages in thread
From: Bart Van Assche @ 2017-02-28 22:45 UTC (permalink / raw)
To: Joe Perches, eugenia-VPRAkNaXOzVWk0Htik3J/w,
dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
yishaih-VPRAkNaXOzVWk0Htik3J/w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On 02/28/2017 02:23 PM, Joe Perches wrote:
> On Tue, 2017-02-28 at 15:35 +0000, Bart Van Assche wrote:
>> On Tue, 2017-02-28 at 15:02 +0300, Dan Carpenter wrote:
>>> Bitwise & was obviously intended here.
> []
>>> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
> []
>>> @@ -109,7 +109,7 @@ static inline void (u8 *addr, u64 mac)
>>> int i;
>>>
>>> for (i = ETH_ALEN; i > 0; i--) {
>>> - addr[i - 1] = mac && 0xFF;
>>> + addr[i - 1] = mac & 0xFF;
>>> mac >>= 8;
>>> }
>>> }
>>
>> Is this the only place where such a loop occurs?
>
> Seems to be.
>
>> Should a put_unaligned_be48()
>> function be introduced?
>
> Why? This is used exactly once.
Really? Here is an example of another open-coded version of
put_unaligned_be48() from arch/mips/cavium-octeon/octeon-platform.c:
new_mac[0] = (mac >> 40) & 0xff;
new_mac[1] = (mac >> 32) & 0xff;
new_mac[2] = (mac >> 24) & 0xff;
new_mac[3] = (mac >> 16) & 0xff;
new_mac[4] = (mac >> 8) & 0xff;
new_mac[5] = mac & 0xff;
Bart.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
2017-02-28 22:45 ` Bart Van Assche
@ 2017-03-01 6:52 ` Julia Lawall
-1 siblings, 0 replies; 17+ messages in thread
From: Julia Lawall @ 2017-03-01 6:52 UTC (permalink / raw)
To: Bart Van Assche
Cc: Joe Perches, eugenia, dan.carpenter, yishaih, netdev, linux-rdma,
kernel-janitors
On Tue, 28 Feb 2017, Bart Van Assche wrote:
> On 02/28/2017 02:23 PM, Joe Perches wrote:
> > On Tue, 2017-02-28 at 15:35 +0000, Bart Van Assche wrote:
> >> On Tue, 2017-02-28 at 15:02 +0300, Dan Carpenter wrote:
> >>> Bitwise & was obviously intended here.
> > []
> >>> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
> > []
> >>> @@ -109,7 +109,7 @@ static inline void (u8 *addr, u64 mac)
> >>> int i;
> >>>
> >>> for (i = ETH_ALEN; i > 0; i--) {
> >>> - addr[i - 1] = mac && 0xFF;
> >>> + addr[i - 1] = mac & 0xFF;
> >>> mac >>= 8;
> >>> }
> >>> }
> >>
> >> Is this the only place where such a loop occurs?
> >
> > Seems to be.
> >
> >> Should a put_unaligned_be48()
> >> function be introduced?
> >
> > Why? This is used exactly once.
>
> Really? Here is an example of another open-coded version of
> put_unaligned_be48() from arch/mips/cavium-octeon/octeon-platform.c:
>
> new_mac[0] = (mac >> 40) & 0xff;
> new_mac[1] = (mac >> 32) & 0xff;
> new_mac[2] = (mac >> 24) & 0xff;
> new_mac[3] = (mac >> 16) & 0xff;
> new_mac[4] = (mac >> 8) & 0xff;
> new_mac[5] = mac & 0xff;
drivers/media/radio/radio-shark2.c:
for (i = 0; i < 6; i++)
shark->transfer_buffer[i + 1] = (reg >> (40 - i * 8)) & 0xff;
drivers/rtc/rtc-ab3100.c
buf[0] = (hw_counter) & 0xFF;
buf[1] = (hw_counter >> 8) & 0xFF;
buf[2] = (hw_counter >> 16) & 0xFF;
buf[3] = (hw_counter >> 24) & 0xFF;
buf[4] = (hw_counter >> 32) & 0xFF;
buf[5] = (hw_counter >> 40) & 0xFF;
drivers/net/ethernet/sun/ldmvsw.c
for (i = 0; i < ETH_ALEN; i++)
port->raddr[i] = (*rmac >> (5 - i) * 8) & 0xff;
drivers/net/ethernet/sun/sunvnet.c
for (i = 0; i < ETH_ALEN; i++)
dev->dev_addr[i] = (*local_mac >> (5 - i) * 8) & 0xff;
for (i = 0; i < ETH_ALEN; i++)
port->raddr[i] = (*rmac >> (5 - i) * 8) & 0xff;
julia
>
> Bart.
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
@ 2017-03-01 6:52 ` Julia Lawall
0 siblings, 0 replies; 17+ messages in thread
From: Julia Lawall @ 2017-03-01 6:52 UTC (permalink / raw)
To: Bart Van Assche
Cc: Joe Perches, eugenia, dan.carpenter, yishaih, netdev, linux-rdma,
kernel-janitors
On Tue, 28 Feb 2017, Bart Van Assche wrote:
> On 02/28/2017 02:23 PM, Joe Perches wrote:
> > On Tue, 2017-02-28 at 15:35 +0000, Bart Van Assche wrote:
> >> On Tue, 2017-02-28 at 15:02 +0300, Dan Carpenter wrote:
> >>> Bitwise & was obviously intended here.
> > []
> >>> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
> > []
> >>> @@ -109,7 +109,7 @@ static inline void (u8 *addr, u64 mac)
> >>> int i;
> >>>
> >>> for (i = ETH_ALEN; i > 0; i--) {
> >>> - addr[i - 1] = mac && 0xFF;
> >>> + addr[i - 1] = mac & 0xFF;
> >>> mac >>= 8;
> >>> }
> >>> }
> >>
> >> Is this the only place where such a loop occurs?
> >
> > Seems to be.
> >
> >> Should a put_unaligned_be48()
> >> function be introduced?
> >
> > Why? This is used exactly once.
>
> Really? Here is an example of another open-coded version of
> put_unaligned_be48() from arch/mips/cavium-octeon/octeon-platform.c:
>
> new_mac[0] = (mac >> 40) & 0xff;
> new_mac[1] = (mac >> 32) & 0xff;
> new_mac[2] = (mac >> 24) & 0xff;
> new_mac[3] = (mac >> 16) & 0xff;
> new_mac[4] = (mac >> 8) & 0xff;
> new_mac[5] = mac & 0xff;
drivers/media/radio/radio-shark2.c:
for (i = 0; i < 6; i++)
shark->transfer_buffer[i + 1] = (reg >> (40 - i * 8)) & 0xff;
drivers/rtc/rtc-ab3100.c
buf[0] = (hw_counter) & 0xFF;
buf[1] = (hw_counter >> 8) & 0xFF;
buf[2] = (hw_counter >> 16) & 0xFF;
buf[3] = (hw_counter >> 24) & 0xFF;
buf[4] = (hw_counter >> 32) & 0xFF;
buf[5] = (hw_counter >> 40) & 0xFF;
drivers/net/ethernet/sun/ldmvsw.c
for (i = 0; i < ETH_ALEN; i++)
port->raddr[i] = (*rmac >> (5 - i) * 8) & 0xff;
drivers/net/ethernet/sun/sunvnet.c
for (i = 0; i < ETH_ALEN; i++)
dev->dev_addr[i] = (*local_mac >> (5 - i) * 8) & 0xff;
for (i = 0; i < ETH_ALEN; i++)
port->raddr[i] = (*rmac >> (5 - i) * 8) & 0xff;
julia
>
> Bart.
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
2017-03-01 6:52 ` Julia Lawall
@ 2017-03-01 8:34 ` Tariq Toukan
-1 siblings, 0 replies; 17+ messages in thread
From: Tariq Toukan @ 2017-03-01 8:34 UTC (permalink / raw)
To: Julia Lawall, Bart Van Assche
Cc: Joe Perches, eugenia-VPRAkNaXOzVWk0Htik3J/w,
dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
yishaih-VPRAkNaXOzVWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On 01/03/2017 8:52 AM, Julia Lawall wrote:
> On Tue, 28 Feb 2017, Bart Van Assche wrote:
>
>> On 02/28/2017 02:23 PM, Joe Perches wrote:
>>> On Tue, 2017-02-28 at 15:35 +0000, Bart Van Assche wrote:
>>>> On Tue, 2017-02-28 at 15:02 +0300, Dan Carpenter wrote:
>>>>> Bitwise & was obviously intended here.
>>> []
>>>>> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
>>> []
>>>>> @@ -109,7 +109,7 @@ static inline void (u8 *addr, u64 mac)
>>>>> int i;
>>>>>
>>>>> for (i = ETH_ALEN; i > 0; i--) {
>>>>> - addr[i - 1] = mac && 0xFF;
>>>>> + addr[i - 1] = mac & 0xFF;
>>>>> mac >>= 8;
>>>>> }
>>>>> }
>>>>
>>>> Is this the only place where such a loop occurs?
>>>
>>> Seems to be.
>>>
>>>> Should a put_unaligned_be48()
>>>> function be introduced?
>>>
>>> Why? This is used exactly once.
>>
>> Really? Here is an example of another open-coded version of
>> put_unaligned_be48() from arch/mips/cavium-octeon/octeon-platform.c:
>>
>> new_mac[0] = (mac >> 40) & 0xff;
>> new_mac[1] = (mac >> 32) & 0xff;
>> new_mac[2] = (mac >> 24) & 0xff;
>> new_mac[3] = (mac >> 16) & 0xff;
>> new_mac[4] = (mac >> 8) & 0xff;
>> new_mac[5] = mac & 0xff;
>
> drivers/media/radio/radio-shark2.c:
> for (i = 0; i < 6; i++)
> shark->transfer_buffer[i + 1] = (reg >> (40 - i * 8)) & 0xff;
>
> drivers/rtc/rtc-ab3100.c
> buf[0] = (hw_counter) & 0xFF;
> buf[1] = (hw_counter >> 8) & 0xFF;
> buf[2] = (hw_counter >> 16) & 0xFF;
> buf[3] = (hw_counter >> 24) & 0xFF;
> buf[4] = (hw_counter >> 32) & 0xFF;
> buf[5] = (hw_counter >> 40) & 0xFF;
>
> drivers/net/ethernet/sun/ldmvsw.c
> for (i = 0; i < ETH_ALEN; i++)
> port->raddr[i] = (*rmac >> (5 - i) * 8) & 0xff;
>
> drivers/net/ethernet/sun/sunvnet.c
> for (i = 0; i < ETH_ALEN; i++)
> dev->dev_addr[i] = (*local_mac >> (5 - i) * 8) & 0xff;
>
> for (i = 0; i < ETH_ALEN; i++)
> port->raddr[i] = (*rmac >> (5 - i) * 8) & 0xff;
>
> julia
>
With these code replication examples, I agree that a function should be
introduced.
>>
>> Bart.
>> --
>> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
@ 2017-03-01 8:34 ` Tariq Toukan
0 siblings, 0 replies; 17+ messages in thread
From: Tariq Toukan @ 2017-03-01 8:34 UTC (permalink / raw)
To: Julia Lawall, Bart Van Assche
Cc: Joe Perches, eugenia-VPRAkNaXOzVWk0Htik3J/w,
dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
yishaih-VPRAkNaXOzVWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On 01/03/2017 8:52 AM, Julia Lawall wrote:
> On Tue, 28 Feb 2017, Bart Van Assche wrote:
>
>> On 02/28/2017 02:23 PM, Joe Perches wrote:
>>> On Tue, 2017-02-28 at 15:35 +0000, Bart Van Assche wrote:
>>>> On Tue, 2017-02-28 at 15:02 +0300, Dan Carpenter wrote:
>>>>> Bitwise & was obviously intended here.
>>> []
>>>>> diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
>>> []
>>>>> @@ -109,7 +109,7 @@ static inline void (u8 *addr, u64 mac)
>>>>> int i;
>>>>>
>>>>> for (i = ETH_ALEN; i > 0; i--) {
>>>>> - addr[i - 1] = mac && 0xFF;
>>>>> + addr[i - 1] = mac & 0xFF;
>>>>> mac >>= 8;
>>>>> }
>>>>> }
>>>>
>>>> Is this the only place where such a loop occurs?
>>>
>>> Seems to be.
>>>
>>>> Should a put_unaligned_be48()
>>>> function be introduced?
>>>
>>> Why? This is used exactly once.
>>
>> Really? Here is an example of another open-coded version of
>> put_unaligned_be48() from arch/mips/cavium-octeon/octeon-platform.c:
>>
>> new_mac[0] = (mac >> 40) & 0xff;
>> new_mac[1] = (mac >> 32) & 0xff;
>> new_mac[2] = (mac >> 24) & 0xff;
>> new_mac[3] = (mac >> 16) & 0xff;
>> new_mac[4] = (mac >> 8) & 0xff;
>> new_mac[5] = mac & 0xff;
>
> drivers/media/radio/radio-shark2.c:
> for (i = 0; i < 6; i++)
> shark->transfer_buffer[i + 1] = (reg >> (40 - i * 8)) & 0xff;
>
> drivers/rtc/rtc-ab3100.c
> buf[0] = (hw_counter) & 0xFF;
> buf[1] = (hw_counter >> 8) & 0xFF;
> buf[2] = (hw_counter >> 16) & 0xFF;
> buf[3] = (hw_counter >> 24) & 0xFF;
> buf[4] = (hw_counter >> 32) & 0xFF;
> buf[5] = (hw_counter >> 40) & 0xFF;
>
> drivers/net/ethernet/sun/ldmvsw.c
> for (i = 0; i < ETH_ALEN; i++)
> port->raddr[i] = (*rmac >> (5 - i) * 8) & 0xff;
>
> drivers/net/ethernet/sun/sunvnet.c
> for (i = 0; i < ETH_ALEN; i++)
> dev->dev_addr[i] = (*local_mac >> (5 - i) * 8) & 0xff;
>
> for (i = 0; i < ETH_ALEN; i++)
> port->raddr[i] = (*rmac >> (5 - i) * 8) & 0xff;
>
> julia
>
With these code replication examples, I agree that a function should be
introduced.
>>
>> Bart.
>> --
>> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
2017-02-28 12:02 ` Dan Carpenter
@ 2017-03-01 17:52 ` David Miller
-1 siblings, 0 replies; 17+ messages in thread
From: David Miller @ 2017-03-01 17:52 UTC (permalink / raw)
To: dan.carpenter; +Cc: yishaih, eugenia, linux-rdma, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 28 Feb 2017 15:02:15 +0300
> Bitwise & was obviously intended here.
>
> Fixes: 745d8ae4622c ("net/mlx4: Spoofcheck and zero MAC can't coexist")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] net/mlx4: && vs & typo
@ 2017-03-01 17:52 ` David Miller
0 siblings, 0 replies; 17+ messages in thread
From: David Miller @ 2017-03-01 17:52 UTC (permalink / raw)
To: dan.carpenter; +Cc: yishaih, eugenia, linux-rdma, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 28 Feb 2017 15:02:15 +0300
> Bitwise & was obviously intended here.
>
> Fixes: 745d8ae4622c ("net/mlx4: Spoofcheck and zero MAC can't coexist")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2017-03-01 17:52 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28 12:02 [patch] net/mlx4: && vs & typo Dan Carpenter
2017-02-28 12:02 ` Dan Carpenter
2017-02-28 15:35 ` Bart Van Assche
2017-02-28 15:35 ` Bart Van Assche
[not found] ` <1488296129.3056.1.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-02-28 22:23 ` Joe Perches
2017-02-28 22:23 ` Joe Perches
2017-02-28 22:45 ` Bart Van Assche
2017-02-28 22:45 ` Bart Van Assche
2017-03-01 6:52 ` Julia Lawall
2017-03-01 6:52 ` Julia Lawall
2017-03-01 8:34 ` Tariq Toukan
2017-03-01 8:34 ` Tariq Toukan
2017-02-28 16:53 ` Tariq Toukan
2017-02-28 16:53 ` Tariq Toukan
2017-02-28 16:53 ` Tariq Toukan
2017-03-01 17:52 ` David Miller
2017-03-01 17:52 ` David Miller
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.