Skip to contentSkip to conversation

i915: Fix uninitialized variable err

PATCH New Colin King 2 participants 2 messages Mar 29, 2021

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 i915: Fix uninitialized variable err

From: Colin Ian King <[email protected]>

In the case where !sg_dma_len(sgl) breaks out of the do-while loop on the first iteration, error variable err has not been assigned any value and will contain garbage. Fix this by ensuring err is initialized to zero.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes 204302d90503 ("i915: fix remap_io_sg to verify the pgprot")
---
 drivers/gpu/drm/i915/i915_mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_mm.c +1 -1
index 4c8cd08c672d..25576fa73ff0 100644
@@ -47,7 +47,7 @@ int remap_io_sg(struct vm_area_struct *vma,
 		struct scatterlist *sgl, resource_size_t iobase)
 {
 	unsigned long pfn, len, remapped = 0;
-	int err;
+	int err = 0;
 
 	/* We rely on prevalidation of the io-mapping to skip track_pfn(). */
 	GEM_BUG_ON((vma->vm_flags & EXPECTED_FLAGS) != EXPECTED_FLAGS);
Signature · 6 lines
2.30.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for i915: Fix uninitialized variable err

== Series Details ==

== Series Details ==

Series: i915: Fix uninitialized variable err
URL : https://patchwork.freedesktop.org/series/88545/
State : failure

== Summary ==

Applying: i915: Fix uninitialized variable err
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/i915_mm.c
Falling back to patching base and 3-way merge... Auto-merging drivers/gpu/drm/i915/i915_mm.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/i915_mm.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 i915: Fix uninitialized variable err When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx