lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 15 Aug 2019 16:36:48 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     sr@...x.de
Cc:     netdev@...r.kernel.org, opensource@...rst.com,
        daniel@...rotopia.org, sean.wang@...iatek.com, john@...ozen.org
Subject: Re: [PATCH net-next 4/4 v2] net: ethernet: mediatek: Add MT7628/88
 SoC support

From: Stefan Roese <sr@...x.de>
Date: Wed, 14 Aug 2019 13:18:25 +0200

> +static int txd_to_idx(struct mtk_tx_ring *ring, struct mtk_tx_dma *dma)
> +{
> +	return ((u32)dma - (u32)ring->dma) / sizeof(*dma);
> +}

This will definitely warn on 64-bit, and you should avoid that even if this
driver can not possibly be built on 64-bit platforms.

You cannot truncate a pointer to an integer which is potentially smaller
in representation size than a pointer could potentially be.

Just can avoid all of these issues by using real pointer arithmetic and
casting to (char *), or even better, (void *).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ