From ce2ba13bed42c975a048fc56774d425774ad632c Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Fri, 16 Feb 2024 14:15:07 +0300 Subject: [PATCH] scst_vdisk: Fix check for blockio device Suppress the following (false positive) Coverity complaint: CID 347415: (#1 of 1): Dereference after null check (FORWARD_NULL) var_deref_model: Passing null pointer virt_dev->bdev_handle to bdev_release_backport, which dereferences it --- .gitignore | 1 + scst/src/dev_handlers/scst_vdisk.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 60d04ac80..bcb84e655 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ *.sdtstub.S *~ .cache.mk +.cache/ .ctf .depend_adm .depend_d diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 2d044cce4..4e52a229f 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -1335,7 +1335,7 @@ static int vdisk_open_fd(struct scst_vdisk_dev *virt_dev, bool read_only) * For block devices, get the optimal I/O size from the block device * characteristics. */ - if (virt_dev->bdev_handle && !virt_dev->opt_trans_len_set) + if (virt_dev->blockio && !virt_dev->opt_trans_len_set) virt_dev->opt_trans_len = bdev_io_opt(virt_dev->bdev_handle->bdev) ? : virt_dev->opt_trans_len;