[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202209160101.2A240E9@keescook>
Date: Fri, 16 Sep 2022 01:07:25 -0700
From: Kees Cook <keescook@...omium.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>,
Peter Rosin <peda@...ntia.se>, Wolfram Sang <wsa@...nel.org>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] i2c: mux: harden i2c_mux_alloc() against integer
overflows
On Thu, Sep 15, 2022 at 05:09:45PM +0300, Dan Carpenter wrote:
> It would probaby be useful to mark passed data as explicitly unsafe for
> integer overflows. Smatch already tracks user data. And if the user
> data has been capped to an unknown value. But this would be a
> completely separate flag which says that "this value came from
> size_add/mul()".
I really want a __must_check_type(size_t) attribute or something for
functions, so we can get a subset of -Wconversion warnings, etc.
> drivers/char/tpm/eventlog/tpm2.c:57 tpm2_bios_measurements_start() warn: using integer overflow function 'size_add()' for math
> [...]
> drivers/net/ethernet/intel/ice/ice_flex_pipe.c:2070 ice_pkg_buf_reserve_section() warn: using integer overflow function 'size_mul()' for math
I see size_add() and size_mul() here. I would have expected some
size_sub() opportunities too? Did nothing pop out?
--
Kees Cook
Powered by blists - more mailing lists