diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build index a5b022d..91bf5c2 100755 --- a/kpatch-build/kpatch-build +++ b/kpatch-build/kpatch-build @@ -250,14 +250,15 @@ fi [[ -z $TARGETS ]] && TARGETS="vmlinux modules" -PATCHNAME="$(basename $PATCHFILE)" +PATCHNAME=$(basename "$PATCHFILE") 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"