Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rapidio: remove unnecessary use of list iterator

req->map is set in the valid case and always equals 'map' if the break was
hit. It therefore is unnecessary to use the list iterator variable and
the use of 'map' can be replaced with req->map.

This is done in preparation to limit the scope of a list iterator to the
list traversal loop [1].

Link: https://lore.kernel.org/all/YhdfEIwI4EdtHdym@kroah.com/
Link: https://lkml.kernel.org/r/20220319203344.2547702-1-jakobkoschel@gmail.com
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Alexandre Bounine <alex.bou9@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: "Brian Johannesmeyer" <bjohannesmeyer@gmail.com>
Cc: Cristiano Giuffrida <c.giuffrida@vu.nl>
Cc: "Bos, H.J." <h.j.bos@vu.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Jakob Koschel and committed by
akpm
f8323a0c 16b0b7ad

+2 -2
+2 -2
drivers/rapidio/devices/rio_mport_cdev.c
··· 915 915 goto err_req; 916 916 } 917 917 918 - if (xfer->length + xfer->offset > map->size) { 918 + if (xfer->length + xfer->offset > req->map->size) { 919 919 ret = -EINVAL; 920 920 goto err_req; 921 921 } ··· 927 927 } 928 928 929 929 sg_set_buf(req->sgt.sgl, 930 - map->virt_addr + (baddr - map->phys_addr) + 930 + req->map->virt_addr + (baddr - req->map->phys_addr) + 931 931 xfer->offset, xfer->length); 932 932 } 933 933