kpatch-build: truncate long patch names

Otherwise the module name listed in /proc/modules is corrupted due to an
array buffer overrun.
This commit is contained in:
Josh Poimboeuf 2014-07-29 17:02:48 -05:00
parent a0756a5f1d
commit 4f91924d7e

View File

@ -255,9 +255,10 @@ if [[ "$PATCHNAME" =~ \.patch ]] || [[ "$PATCHNAME" =~ \.diff ]]; then
PATCHNAME="${PATCHNAME%.*}"
fi
# Only allow alphanumerics and '_' and '-' in the module name.
# Everything else is replaced with '-'.
PATCHNAME=${PATCHNAME//[^a-zA-Z0-9_-]/-}
# Only allow alphanumerics and '_' and '-' in the module name. Everything else
# is replaced with '-'. Also truncate to 48 chars so the full name fits in the
# kernel's 56-byte module name array.
PATCHNAME=$(echo ${PATCHNAME//[^a-zA-Z0-9_-]/-} |cut -c 1-48)
find_dirs || die "can't find supporting tools"