diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index 28d2bd596..bae7977cf 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -109,7 +109,7 @@ function specialize_patch { if [ "${enable_specialize}" = "true" ]; then "$(dirname $0)/specialize-patch" \ ${specialize_patch_options} \ - -v kernel_version="${kver}" \ + -v kernel_version="${kver3}" \ -v SCSI_EXEC_REQ_FIFO_DEFINED="${scsi_exec_req_fifo_defined}" \ -v SCST_IO_CONTEXT="${scst_io_context}" \ | if [ "${generating_upstream_patch}" = "true" ]; then @@ -210,6 +210,12 @@ fi # Strip patch level from the kernel version number. kver="$(kernel_version "$1")" +# kver3: first three components of the version number. +if [ "${1#2.}" != "$1" ]; then + kver3="$kver" +else + kver3="$1" +fi # Include fcst in the patch for kernel versions 2.6.33 and later. if [ "${kver}" ">" "2.6.32" ]; then diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 72a7032b6..45cb219ba 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -338,7 +338,7 @@ function run_sparse { && make -s prepare \ && make -s scripts \ && if grep -q '^CONFIG_PPC=y$' .config; then LC_ALL=C make -k M=arch/powerpc/lib; fi \ - && LC_ALL=C make -k C=2 CF=-D__CHECK_ENDIAN__ M="${subdir}" "$@" + && LC_ALL=C make -k C=2 CF="-D__CHECK_ENDIAN__ -DCONFIG_SPARSE_RCU_POINTER" M="${subdir}" "$@" ) &> "${outputfile}" then local errors=$(grep -c ' error:' "${outputfile}") diff --git a/scripts/specialize-patch b/scripts/specialize-patch index 011eb24d2..f3ae24262 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -31,8 +31,8 @@ # the KERNEL_VERSION() macro. function version_code(kver, array) { - if (!match(kver, "([0-9]+).([0-9]+).([0-9]+)", array)) - match(kver, "([0-9]+).([0-9]+)", array) + if (!match(kver, "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$", array)) + match(kver, "^([0-9]+)\\.([0-9]+)$", array) return 65536*array[1] + 256*array[2] + array[3] } @@ -65,6 +65,12 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("LINUX_VERSION_CODE", LINUX_VERSION_CODE, stmnt) + pattern="KERNEL_VERSION\\([[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*\\)" + while (match(stmnt, pattern, op) != 0) + { + sub(pattern, op[1] * 65536 + op[2] * 256 + op[3], stmnt) + } + gsub("defined\\(INSIDE_KERNEL_TREE\\)", "1", stmnt) gsub("defined\\(BACKPORT_LINUX_WORKQUEUE_TO_2_6_19\\)", "0", stmnt) @@ -151,12 +157,6 @@ function evaluate(stmnt, pattern, arg, op, result) { sub(pattern, op[1] == 0, stmnt) } - pattern="KERNEL_VERSION\\([[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*\\)" - while (match(stmnt, pattern, op) != 0) - { - sub(pattern, op[1] * 65536 + op[2] * 256 + op[3], stmnt) - } - pattern="(-*[0-9]+)[[:blank:]]*(\\*|/)[[:blank:]]*(-*[0-9]+)" while (match(stmnt, pattern, op) != 0) { @@ -174,6 +174,15 @@ function evaluate(stmnt, pattern, arg, op, result) { else if (op[2] == "-") result = op[1] - op[3] sub(pattern, result, stmnt) } + + pattern="(-*[0-9]+)[[:blank:]]*(<<|>>)[[:blank:]]*(-*[0-9]+)" + while (match(stmnt, pattern, op) != 0) + { + result="error" + if (op[2] == "<<") result = int(op[1] * (2**op[3])) + else if (op[2] == ">>") result = int(op[1] / (2**op[3])) + sub(pattern, result, stmnt) + } pattern="(-*[0-9]+)[[:blank:]]*(<|<=|>|>=|==|!=)[[:blank:]]*(-*[0-9]+)" while (match(stmnt, pattern, op) != 0)