Gleb Chesnokov ea17dc18f5 scst_lib: Start explicit buffer iteration at the supplied scatterlist
Manual review found that the explicit scatterlist argument is checked
but not used to initialize traversal. The saved pre-fix Cppcheck log
also contains this style diagnostic for the helper:

  scst/include/scst.h:5012: style:
  Parameter 'sg' can be declared as pointer to const
  [constParameterPointer]

That message describes the argument's limited use; it does not diagnose
the wrong-list traversal or NULL dereference fixed here.

scst_get_sg_buf_first() checks its sg argument and uses sg_cnt as the
iteration bound, but initializes the cursor from cmd->sg. Supplying a
different list therefore reads the wrong buffers with an unrelated
length limit. A valid explicit list with cmd->sg == NULL also reaches a
NULL scatterlist in __scst_get_buf().

Initialize the cursor from sg, keeping the list and its element count
paired. The public helper's signature and command-buffer helpers remain
unchanged. The in-tree scst_zero_write_rest() caller selects write_sg,
which can be out_sg for bidirectional commands, although its own call
site is currently disabled by #if 0. This fixes the helper contract; it
does not establish a currently reachable in-tree I/O corruption path.

Add LIB KUnit coverage for a two-entry explicit list when cmd->sg points
to another list or is NULL, including end-of-list and DMA-sync state.
Also cover NULL and zero-length selections. This source-level defect
was confirmed while reviewing the historical analyzer fixes; no new
analyzer model or suppression is required.
2026-10-21 09:23:02 +03:00

SCST

Coverity Downloads

Overview

This is the source code repository of the SCST project. SCST is a collection of Linux kernel drivers that implement SCSI target functionality. The SCST project includes:

  1. The SCST core in the scst/ subdirectory.
  2. A tool for loading, saving and modifying the SCST configuration in directory scstadmin/.
  3. Several SCSI target drivers in the directories iscsi-scst/, qla2x00t-32gbit/, qla2x00t/, srpt/, scst_local/ and fcst/.
  4. User space programs in the usr/ subdirectory, e.g. fileio_tgt.
  5. Various documentation in the doc/ subdirectory.

Documentation

Current master packages

Prebuilt x86_64 packages from the latest successfully published master build are available in the rolling master-rpm prerelease. These are development snapshots, not SCST releases.

The snapshot contains RPM bundles for selected Rocky Linux and Oracle Linux UEK kernels. It also contains Ubuntu LTS bundles with scst-dkms, scstadmin and iscsi-scst binary packages and their Debian source package files. Exact distribution releases and RPM kernel versions are included in the asset names. Every .tar.gz bundle has a matching .sha256 file. The complete snapshot is replaced after each successful package workflow for the current master commit.

QLogic target driver

Two QLogic target drivers are included in the SCST project.

The default driver is located in the qla2x00t-32gbit directory. It is the newer one.

May anyone wish to switch back to the older driver that only supported up to 16 Gb/s adapters, it is located in qla2x00t directory. To make use of the older driver build scst with environment variable QLA_32GBIT=no set.

Vladislav Bolkhovitin vst@vlnb.net, http://scst.sourceforge.net

Sourceforge achievements

S
Description
No description provided
Readme
39 MiB
Languages
C 82.6%
Python 5.6%
Perl 3.6%
Go 3%
Shell 1.8%
Other 3.3%