]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/x86/net/bpf_jit_comp.c
Merge branches 'iommu/fixes', 'arm/omap', 'arm/smmu', 'arm/shmobile', 'x86/amd',...
[karo-tx-linux.git] / arch / x86 / net / bpf_jit_comp.c
index dc017735bb91b7b2ec61f333b091c63accdb921b..6d5663a599a7a362756b5bcb6d3ff3e30ee34bae 100644 (file)
@@ -171,7 +171,7 @@ static struct bpf_binary_header *bpf_alloc_binary(unsigned int proglen,
        memset(header, 0xcc, sz); /* fill whole space with int3 instructions */
 
        header->pages = sz / PAGE_SIZE;
-       hole = sz - (proglen + sizeof(*header));
+       hole = min(sz - (proglen + sizeof(*header)), PAGE_SIZE - sizeof(*header));
 
        /* insert a random number of int3 instructions before BPF code */
        *image_ptr = &header->image[prandom_u32() % hole];