Re: [PATCH v4 1/7] cxl/region: Avoid null pointer dereference in is_cxl_region()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04.06.25 14:56:22, Nathan Fontenot wrote:
> On 6/3/2025 6:49 PM, Dave Jiang wrote:
> > 
> > 
> > On 6/3/25 3:19 PM, Smita Koralahalli wrote:
> >> Add a NULL check in is_cxl_region() to prevent potential null pointer
> >> dereference if a caller passes a NULL device. This change ensures the
> >> function safely returns false instead of triggering undefined behavior
> >> when dev is NULL.
> > 
> > Don't think this change is necessary. The code paths should not be hitting any NULL region devices unless it's a programming error.
> 
> I originally added this to the patchset during some initial development to handle possible
> NULL dev pointers when updating soft reserve resources, see cxl_region_softreserv_update()
> in patch 5/7.
> 
> In the current form of the that routine it appears we shouldn't execute the while loop
> if dev is NULL so this could get from the patch set.

With the suggested change to use bus_for_each_dev() in patch #5 this
patch should be dropped.

-Robert




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux