]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: Intel: catpt: Fix offset checks
authorCezary Rojewski <cezary.rojewski@intel.com>
Wed, 26 Nov 2025 09:55:18 +0000 (10:55 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 27 Nov 2025 11:41:12 +0000 (11:41 +0000)
Verify if the entire block is found within DRAM, not just
the start of it.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20251126095523.3925364-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/catpt/loader.c

index 696d84314eeb5edcc83c93b3dead2a4d00d5f082..5804de1d89e3b93dededa447a37a523a0b395287 100644 (file)
@@ -216,7 +216,7 @@ static int catpt_restore_memdumps(struct catpt_dev *cdev, struct dma_chan *chan)
                        continue;
 
                off = catpt_to_host_offset(info->offset);
-               if (off < cdev->dram.start || off > cdev->dram.end)
+               if (off < cdev->dram.start || off + info->size >= cdev->dram.end)
                        continue;
 
                dev_dbg(cdev->dev, "restoring memdump: off 0x%08x size %d\n",
@@ -261,12 +261,12 @@ static int catpt_restore_fwimage(struct catpt_dev *cdev,
                        continue;
 
                off = catpt_to_host_offset(info->offset);
-               if (off < cdev->dram.start || off > cdev->dram.end)
-                       continue;
-
                r2.start = off;
                r2.end = r2.start + info->size - 1;
 
+               if (r2.start < cdev->dram.start || r2.end > cdev->dram.end)
+                       continue;
+
                if (!resource_intersection(&r2, &r1, &common))
                        continue;
                /* calculate start offset of common data area */