diff --git a/Makefile b/Makefile index 8eb917e75..78bb23af2 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ REVISION ?= $(shell if [ -e .svn ]; then \ fi) VERSION_WITHOUT_REVISION := $(shell echo -n "$$(sed -n 's/^\#define[[:blank:]]SCST_VERSION_NAME[[:blank:]]*\"\([^-]*\).*\"/\1/p' scst/include/scst_const.h)") VERSION := $(VERSION_WITHOUT_REVISION)$(REVISION) -DEBIAN_REVISION=1 +DEBIAN_REVISION=1.1 RPMTOPDIR ?= $(shell if [ $$(id -u) = 0 ]; then echo /usr/src/packages;\ else echo $$PWD/rpmbuilddir; fi) @@ -289,8 +289,9 @@ make-scst-dist = \ mkdir "$${name}-$(3)" && \ { \ { \ - scripts/list-source-files && \ + scripts/list-source-files | grep -v '/\.gitignore' && \ if [ -e debian/changelog ]; then echo debian/changelog; fi; \ + if [ -e debian/compat ]; then echo debian/compat; fi; \ } | \ $(4) | \ tar -T- -cf- | \ @@ -349,23 +350,21 @@ debian/changelog: debian/changelog.in sed 's/%{scst_version}/$(VERSION)-$(DEBIAN_REVISION)/' \ debian/changelog -../scst_$(VERSION).orig.tar.gz: debian/changelog Makefile +debian/compat: + dpkg-query -W --showformat='$${Version}\n' debhelper 2>/dev/null | \ + sed 's/\..*//' >$@ + +../scst_$(VERSION).orig.tar.gz: debian/changelog debian/compat Makefile $(call make-scst-dist,z,gz,$(VERSION),cat) && \ mv "scst-$(VERSION).tar.gz" "$@" -../scst_$(VERSION).orig.tar.xz: debian/changelog Makefile +../scst_$(VERSION).orig.tar.xz: debian/changelog debian/compat Makefile $(call make-scst-dist,J,xz,$(VERSION),cat) && \ mv "scst-$(VERSION).tar.xz" "$@" dpkg: ../scst_$(VERSION).orig.tar.gz - @if [ -z "$$DEBEMAIL" ]; then \ - echo "Error: \$$DEBEMAIL has not been set"; \ - false; \ - fi && \ - if [ -z "$$DEBFULLNAME" ]; then \ - echo "Error: \$$DEBFULLNAME has not been set"; \ - false; \ - fi && \ + @[ -z "$$DEBEMAIL" ] || export DEBEMAIL=bvanassche@acm.org && \ + [ -z "$$DEBFULLNAME" ] || export DEBFULLNAME="Bart Van Assche" &&\ sed 's/%{scst_version}/$(VERSION)/' \ debian/scst.dkms && \ output_files=( \ diff --git a/debian/rules b/debian/rules index b7ca75918..f78e364a0 100755 --- a/debian/rules +++ b/debian/rules @@ -24,8 +24,7 @@ VERSION:=$(shell head -n1 debian/changelog | sed 's/.*(\([0-9.]*\).*).*/\1/') clean: dh_testdir && \ dh_prep -Xqla_isp/TAGS -Xdebian/changelog && \ - scripts/clean-source-tree -x debian/changelog && \ - rm -f scstadmin/scstadmin + scripts/clean-source-tree -x debian/changelog -x debian/compat build: make 2release && \ @@ -97,10 +96,8 @@ binary: binary-indep binary-arch override_dh_installinit: dh_installinit --onlyscripts -# dh_make generated override targets -# This is example for Cmake (See https://bugs.debian.org/641051 ) -#override_dh_auto_configure: -# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) +override_dh_auto_configure: + true .PHONY: clean binary binary-arch binary-indep build build-arch build-indep \ install diff --git a/scst/include/backport.h b/scst/include/backport.h index b344f4380..634e8a9ae 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1228,16 +1228,15 @@ static inline int pcie_capability_read_dword(struct pci_dev *dev, int pos, #include #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0) -#if defined(RHEL_RELEASE_CODE) && \ - RHEL_RELEASE_CODE -0 >= RHEL_RELEASE_VERSION(8, 3)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(8, 3)) /* * See also commit 09ed79d6d75f ("percpu_ref: introduce PERCPU_REF_ALLOW_REINIT * flag") # v5.3. */ #define PERCPU_REF_ALLOW_REINIT 0 #endif -#endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) #define PERCPU_COUNT_BIAS (1U << 31) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index a620230e0..bf9a9532f 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -12441,21 +12441,20 @@ int scst_tape_generic_parse(struct scst_cmd *cmd) */ if (cmd->op_flags & SCST_TRANSFER_LEN_TYPE_FIXED && cmd->cdb[1] & 1) { - int block_size = cmd->dev->block_size; - uint64_t b, ob; - bool overflow; + uint32_t block_size = cmd->dev->block_size; + uint32_t block_shift = cmd->dev->block_shift; + bool overflow = shift_left_overflows(cmd->bufflen, block_shift) || + shift_left_overflows(cmd->data_len, block_shift) || + shift_left_overflows(cmd->out_bufflen, block_shift); - b = ((uint64_t)cmd->bufflen) * block_size; - ob = ((uint64_t)cmd->out_bufflen) * block_size; - - overflow = (b > 0xFFFFFFFF) || - (ob > 0xFFFFFFFF); + BUILD_BUG_ON(sizeof(cmd->bufflen) != 4); + BUILD_BUG_ON(sizeof(cmd->out_bufflen) != 4); if (unlikely(overflow)) { PRINT_WARNING("bufflen %u, data_len %llu or out_bufflen" " %u too large for device %s (block size" - " %u, b %llu, ob %llu)", cmd->bufflen, + " %u)", cmd->bufflen, cmd->data_len, cmd->out_bufflen, - cmd->dev->virt_name, block_size, b, ob); + cmd->dev->virt_name, block_size); PRINT_BUFFER("CDB", cmd->cdb, cmd->cdb_len); scst_set_cmd_error(cmd, SCST_LOAD_SENSE( scst_sense_block_out_range_error)); @@ -12463,12 +12462,9 @@ int scst_tape_generic_parse(struct scst_cmd *cmd) goto out; } - cmd->bufflen = b; - cmd->out_bufflen = ob; - - /* cmd->data_len is 64-bit, so can't overflow here */ - BUILD_BUG_ON(sizeof(cmd->data_len) < 8); - cmd->data_len *= block_size; + cmd->bufflen <<= block_shift; + cmd->out_bufflen <<= block_shift; + cmd->data_len <<= block_shift; } if ((cmd->op_flags & (SCST_SMALL_TIMEOUT | SCST_LONG_TIMEOUT)) == 0)