[bug report] powerpc/mm/cxl: Add the fault handling cpu to mm cpumask
Dan Carpenter
dan.carpenter at oracle.com
Fri Aug 25 22:28:26 AEST 2017
Hello Aneesh Kumar K.V,
This is a semi-automatic email about new static checker warnings.
The patch 0f4bc0932e51: "powerpc/mm/cxl: Add the fault handling cpu
to mm cpumask" from Jul 27, 2017, leads to the following Smatch
complaint:
drivers/misc/cxl/fault.c:161 cxl_handle_mm_fault()
warn: variable dereferenced before check 'mm' (see line 146)
drivers/misc/cxl/fault.c
145 */
146 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
^^
The patch adds an unchecked dereference.
147 if ((result = copro_handle_mm_fault(mm, dar, dsisr, &flt))) {
148 pr_devel("copro_handle_mm_fault failed: %#x\n", result);
149 return result;
150 }
151
152 if (!radix_enabled()) {
153 /*
154 * update_mmu_cache() will not have loaded the hash since current->trap
155 * is not a 0x400 or 0x300, so just call hash_page_mm() here.
156 */
157 access = _PAGE_PRESENT | _PAGE_READ;
158 if (dsisr & CXL_PSL_DSISR_An_S)
159 access |= _PAGE_WRITE;
160
161 if (!mm && (REGION_ID(dar) != USER_REGION_ID))
^^
But the existing code is careful to check "mm" for NULL. The
copro_handle_mm_fault() and hash_page_mm() both have checks built in.
162 access |= _PAGE_PRIVILEGED;
163
regards,
dan carpenter
More information about the Linuxppc-dev
mailing list