diff options
| author | Dan Carpenter <[email protected]> | 2022-01-21 11:55:05 +0000 |
|---|---|---|
| committer | Miquel Raynal <[email protected]> | 2022-01-25 09:32:07 +0000 |
| commit | 3e3765875b1b8864898603768fd5c93eeb552211 (patch) | |
| tree | cc469397df15bc29a8360eb14a716788f3935090 /drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | |
| parent | mtd: rawnand: omap2: Prevent invalid configuration and build error (diff) | |
| download | kernel-3e3765875b1b8864898603768fd5c93eeb552211.tar.gz kernel-3e3765875b1b8864898603768fd5c93eeb552211.zip | |
mtd: phram: Prevent divide by zero bug in phram_setup()
The problem is that "erasesize" is a uint64_t type so it might be
non-zero but the lower 32 bits are zero so when it's truncated,
"(uint32_t)erasesize", then that value is zero. This leads to a
divide by zero bug.
Avoid the bug by delaying the divide until after we have validated
that "erasesize" is non-zero and within the uint32_t range.
Fixes: dc2b3e5cbc80 ("mtd: phram: use div_u64_rem to stop overwrite len in phram_setup")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
Link: https://lore.kernel.org/linux-mtd/20220121115505.GI1978@kadam
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c')
0 files changed, 0 insertions, 0 deletions
