Skip to content

Commit ec27938

Browse files
committed
drm/i915: Initialize err in remap_io_sg()
If the do while loop breaks in 'if (!sg_dma_len(sgl))' in the first iteration, err is uninitialized causing a wrong call to zap_vma_ptes(). But that is impossible to happen as a scatterlist must have at least one valid segment. Anyways to avoid more reports from static checkers initializing ret here. Fixes: b12d691 ("i915: fix remap_io_sg to verify the pgprot") Reviewed-by: Christoph Hellwig <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: James Ausmus <[email protected]> Signed-off-by: José Roberto de Souza <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 929b734 commit ec27938

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/i915/i915_mm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int remap_io_sg(struct vm_area_struct *vma,
4747
struct scatterlist *sgl, resource_size_t iobase)
4848
{
4949
unsigned long pfn, len, remapped = 0;
50-
int err;
50+
int err = 0;
5151

5252
/* We rely on prevalidation of the io-mapping to skip track_pfn(). */
5353
GEM_BUG_ON((vma->vm_flags & EXPECTED_FLAGS) != EXPECTED_FLAGS);

0 commit comments

Comments
 (0)