Re: [PATCH RESEND 1/2] ring-buffer/selftest: Verify the entire meta-page padding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shuah,

Can you take this through your tree?

Acked-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>

-- Steve


On Tue, 10 Sep 2024 17:23:34 +0100
Vincent Donnefort <vdonnefort@xxxxxxxxxx> wrote:

> Improve the ring-buffer meta-page test coverage by checking for the
> entire padding region to be 0 instead of just looking at the first 4
> bytes.
> 
> Cc: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
> Cc: linux-kselftest@xxxxxxxxxxxxxxx
> Signed-off-by: Vincent Donnefort <vdonnefort@xxxxxxxxxx>
> 
> diff --git a/tools/testing/selftests/ring-buffer/map_test.c b/tools/testing/selftests/ring-buffer/map_test.c
> index 4bb0192e43f3..ba12fd31de87 100644
> --- a/tools/testing/selftests/ring-buffer/map_test.c
> +++ b/tools/testing/selftests/ring-buffer/map_test.c
> @@ -231,15 +231,15 @@ TEST_F(map, data_mmap)
>  
>  	/* Verify meta-page padding */
>  	if (desc->meta->meta_page_size > getpagesize()) {
> -		void *addr;
> -
>  		data_len = desc->meta->meta_page_size;
>  		data = mmap(NULL, data_len,
>  			    PROT_READ, MAP_SHARED, desc->cpu_fd, 0);
>  		ASSERT_NE(data, MAP_FAILED);
>  
> -		addr = (void *)((unsigned long)data + getpagesize());
> -		ASSERT_EQ(*((int *)addr), 0);
> +		for (int i = desc->meta->meta_struct_len;
> +		     i < desc->meta->meta_page_size; i += sizeof(int))
> +			ASSERT_EQ(*(int *)(data + i), 0);
> +
>  		munmap(data, data_len);
>  	}
>  }





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux