[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZgFSLY_uQkfbyyRG@smile.fi.intel.com>
Date: Mon, 25 Mar 2024 12:30:05 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Denis Arefev <arefev@...mel.ru>
Cc: Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org, trufanov@...mel.ru, vfh@...mel.ru
Subject: Re: [PATCH] mtd: partitions: redboot: Added conversion of operands
to a larger type
On Fri, Mar 15, 2024 at 12:37:58PM +0300, Denis Arefev wrote:
> The value of an arithmetic expression directory * master->erasesize is
> subject to overflow due to a failure to cast operands to a larger data
> type before perfroming arithmetic
..
> - offset = directory * master->erasesize;
> + offset = (unsigned long) directory * master->erasesize;
Usage of explicit casting can be avoided by using size_mul() from overflow.h.
Usually explicit castings are prone to subtle errors.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists