On 10/4/24 9:14 AM, Jason Gunthorpe wrote:
On Fri, Oct 04, 2024 at 09:05:46AM -0700, Yang Shi wrote:
Oh wait a sec, it is not so simple, the 31 is too big because the
On 10/4/24 5:43 AM, Jason Gunthorpe wrote:
On Thu, Oct 03, 2024 at 08:31:23AM -0700, Yang Shi wrote:Thank you. Will spin a new revision.
If I understand correctly, the check is mainly used to avoid the u64 -> u32Sure, the kalloc will print a warn on anyhow if it is too big
overflow. This check guarantee no overflow. If some crazy hardware really
requests that large memory, the allocation will fail.
multiply will overflow or truncate to size_t too. This is why I picked
something lower.
How about define the size as u64?
static int arm_smmu_init_strtab_linear(struct arm_smmu_device *smmu)
{
- u32 size;
+ u64 size;
struct arm_smmu_strtab_cfg *cfg = &smmu->strtab_cfg;
u32 num_sids;
It won't overflow and the large allocation will fail anyway.
Jason