blobstore: workaround for bs_cluster_to_lba() scan-build false positive
Patch https://review.spdk.io/gerrit/c/spdk/spdk/+/16328, introduced a refactor for persist path. No functional change should occur with it, but the code layout after compilation (path length) might have changed. It resulted in unrelated scan-build failure: https://ci.spdk.io/results/autotest-per-patch/builds/95746/archive/scanbuild-vg-autotest/scan-build/report-d08e76.html#EndPath Tried to replicate the issue without the above patch, by increasing maxloop or -analyze-headers in scan-build. Didn't result in any new failures in blobstore. This seemed like a false positive, so it was verified: https://review.spdk.io/gerrit/c/spdk/spdk/+/16333/ With no other options, an assert is added only to the function where the false positive occured. scan-build log for posterity: blobstore.c:1062:58: warning: Division by zero [core.DivideZero] desc_extent_rle->extents[extent_idx].cluster_idx = lba / lba_per_cluster; ~~~~^~~~~~~~~~~~~~~~~ blobstore.c:1079:58: warning: Division by zero [core.DivideZero] desc_extent_rle->extents[extent_idx].cluster_idx = lba / lba_per_cluster; ~~~~^~~~~~~~~~~~~~~~~ Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I9dd729fa13ce1c9bbcb91e4326658e2b4e326e6d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16335 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
01608f1af2
commit
3eb03cc7b6
@ -1045,6 +1045,8 @@ blob_serialize_extent_rle(const struct spdk_blob *blob,
|
||||
desc_extent_rle->type = SPDK_MD_DESCRIPTOR_TYPE_EXTENT_RLE;
|
||||
|
||||
lba_per_cluster = bs_cluster_to_lba(blob->bs, 1);
|
||||
/* Assert for scan-build false positive */
|
||||
assert(lba_per_cluster > 0);
|
||||
|
||||
lba = blob->active.clusters[start_cluster];
|
||||
lba_count = lba_per_cluster;
|
||||
|
Loading…
Reference in New Issue
Block a user