linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* bug report for linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c
@ 2025-03-26 19:25 David Binderman
  2025-03-28 23:14 ` Shuah Khan
  0 siblings, 1 reply; 2+ messages in thread
From: David Binderman @ 2025-03-26 19:25 UTC (permalink / raw)
  To: akpm, shuah, linux-mm, linux-kselftest, linux-kernel

Hello there,

Static analyser cppcheck says:

> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:1061:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:1510:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:1523:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:247:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:435:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:490:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]

The source code of the first one is

    mem_size = 10 * page_size;

Maybe better code:

    mem_size = 10ULL * page_size;

Regards

David Binderman



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

* Re: bug report for linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c
  2025-03-26 19:25 bug report for linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c David Binderman
@ 2025-03-28 23:14 ` Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2025-03-28 23:14 UTC (permalink / raw)
  To: David Binderman, akpm, shuah, linux-mm, linux-kselftest,
	linux-kernel, Shuah Khan

On 3/26/25 13:25, David Binderman wrote:
> Hello there,
> 
> Static analyser cppcheck says:
> 
>> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:1061:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
>> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:1510:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
>> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:1523:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
>> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:247:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
>> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:435:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
>> linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c:490:11: style: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
> 
> The source code of the first one is
> 
>      mem_size = 10 * page_size;
> 
> Maybe better code:
> 
>      mem_size = 10ULL * page_size;
> 
> Regards
> 
> David Binderman
> 

Can you send a patch for us to review?

thanks,
-- Shuah


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

end of thread, other threads:[~2025-03-28 23:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-26 19:25 bug report for linux-6.14/tools/testing/selftests/mm/pagemap_ioctl.c David Binderman
2025-03-28 23:14 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox