bus/pci: fix TOCTOU for sysfs access
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 2 Apr 2019 18:51:05 +0000 (11:51 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 14 Jun 2019 07:33:56 +0000 (16:33 +0900)
commitc530aa78e3747cdd273310eeb9c50603da7f9cb6
tree64cb66c2a4777db1961538ae289e5c1fa8538c9c
parent07517400c4740397477153910edee38268294031
bus/pci: fix TOCTOU for sysfs access

Using access followed by open causes a static analysis warning
about Time of check versus Time of use. Also, access() and
open() have different UID permission checks.

This is not a serious problem; but easy to fix by using errno instead.

Coverity issue: 300870
Fixes: 4a928ef9f611 ("bus/pci: enable write combining during mapping")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: David Marchand <david.marchand@redhat.com>
drivers/bus/pci/linux/pci_uio.c