If kpartx fails to create a copy of the dasd file descriptor, it should fail, instead of treating the error value as a valid fd. Found by coverity. Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> --- kpartx/dasd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kpartx/dasd.c b/kpartx/dasd.c index 61b609a5..d95d8ca0 100644 --- a/kpartx/dasd.c +++ b/kpartx/dasd.c @@ -138,6 +138,8 @@ read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns) return -1; } else { fd_dasd = dup(fd); + if (fd_dasd < 0) + return -1; } if (ioctl(fd_dasd, BIODASDINFO, (unsigned long)&info) != 0) { -- 2.17.2 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel