summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>2016-04-25 20:13:17 +0200
committerDavid S. Miller <davem@davemloft.net>2016-04-28 21:53:17 +0200
commit7b7483409f09c15f30ac43242ead1ab3061e1f59 (patch)
tree8f57c8a87aff3b662bb8146b0f5bf0f56fe5f177 /drivers/net/dsa
parentnet: ethernet: davinci_emac: Fix devioctl while in fixed link (diff)
downloadlinux-7b7483409f09c15f30ac43242ead1ab3061e1f59.tar.xz
linux-7b7483409f09c15f30ac43242ead1ab3061e1f59.zip
net: fix net_gso_ok for new GSO types.
Fix casting in net_gso_ok. Otherwise the shift on gso_type << NETIF_F_GSO_SHIFT may hit the 32th bit and make it look like a INT_MIN, which is then promoted from signed to uint64 which is 0xffffffff80000000, resulting in wrong behavior when it is and'ed with the feature itself, as in: This test app: #include <stdio.h> #include <stdint.h> int main(int argc, char **argv) { uint64_t feature1; uint64_t feature2; int gso_type = 1 << 15; feature1 = gso_type << 16; feature2 = (uint64_t)gso_type << 16; printf("%lx %lx\n", feature1, feature2); return 0; } Gives: ffffffff80000000 80000000 So that this: return (features & feature) == feature; Actually works on more bits than expected and invalid ones. Fix is to promote it earlier. Issue noted while rebasing SCTP GSO patch but posting separetely as someone else may experience this meanwhile. Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
0 files changed, 0 insertions, 0 deletions