LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH linux-next] testing/vm/: fix application of sizeof to pointer
@ 2021-08-20  3:24 CGEL
  2021-08-24 14:40 ` Shuah Khan
  0 siblings, 1 reply; 2+ messages in thread
From: CGEL @ 2021-08-20  3:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Shuah Khan, linux-mm, linux-kselftest, linux-kernel,
	jing yangyang, Zeal Robot

From: jing yangyang <jing.yangyang@zte.com.cn>

sizeof when applied to a pointer typed expression gives the size of the
pointer.

./tools/testing/selftests/vm/split_huge_page_test.c:344:36-42: ERROR application
of sizeof to pointer

This issue was detected with the help of Coccinelle.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
---
 tools/testing/selftests/vm/split_huge_page_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vm/split_huge_page_test.c b/tools/testing/selftests/vm/split_huge_page_test.c
index 1af16d2..54bf57f 100644
--- a/tools/testing/selftests/vm/split_huge_page_test.c
+++ b/tools/testing/selftests/vm/split_huge_page_test.c
@@ -341,7 +341,7 @@ void split_file_backed_thp(void)
 	}
 
 	/* write something to the file, so a file-backed THP can be allocated */
-	num_written = write(fd, tmpfs_loc, sizeof(tmpfs_loc));
+	num_written = write(fd, tmpfs_loc, sizeof(*tmpfs_loc));
 	close(fd);
 
 	if (num_written < 1) {
-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-next] testing/vm/: fix application of sizeof to pointer
  2021-08-20  3:24 [PATCH linux-next] testing/vm/: fix application of sizeof to pointer CGEL
@ 2021-08-24 14:40 ` Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2021-08-24 14:40 UTC (permalink / raw)
  To: CGEL, Andrew Morton
  Cc: Shuah Khan, linux-mm, linux-kselftest, linux-kernel,
	jing yangyang, Zeal Robot, Shuah Khan

On 8/19/21 9:24 PM, CGEL wrote:
> From: jing yangyang <jing.yangyang@zte.com.cn>
> 
> sizeof when applied to a pointer typed expression gives the size of the
> pointer.
> 
> ./tools/testing/selftests/vm/split_huge_page_test.c:344:36-42: ERROR application
> of sizeof to pointer
> 
> This issue was detected with the help of Coccinelle.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
> ---
>   tools/testing/selftests/vm/split_huge_page_test.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/vm/split_huge_page_test.c b/tools/testing/selftests/vm/split_huge_page_test.c
> index 1af16d2..54bf57f 100644
> --- a/tools/testing/selftests/vm/split_huge_page_test.c
> +++ b/tools/testing/selftests/vm/split_huge_page_test.c
> @@ -341,7 +341,7 @@ void split_file_backed_thp(void)
>   	}
>   
>   	/* write something to the file, so a file-backed THP can be allocated */
> -	num_written = write(fd, tmpfs_loc, sizeof(tmpfs_loc));
> +	num_written = write(fd, tmpfs_loc, sizeof(*tmpfs_loc));
>   	close(fd);
>   
>   	if (num_written < 1) {
> 

We can't accept this patch. The from and Signed-off-by don't match.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-24 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20  3:24 [PATCH linux-next] testing/vm/: fix application of sizeof to pointer CGEL
2021-08-24 14:40 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).