lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZCroShx7wdvYW2lS@ziepe.ca>
Date:   Mon, 3 Apr 2023 11:52:58 -0300
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     Steven Price <steven.price@....com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        Thomas Hellstrom <thellstrom@...are.com>,
        Christoph Hellwig <hch@....de>,
        kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] smaps: Fix defined but not used smaps_shmem_walk_ops

On Mon, Apr 03, 2023 at 12:12:55PM +0100, Steven Price wrote:
> When !CONFIG_SHMEM smaps_shmem_walk_ops is defined but not used,
> triggering a compiler warning. Surround the definition with an #ifdef to
> keep the compiler happy.
> 
> Fixes: 7b86ac3371b7 ("pagewalk: separate function pointers from iterator data")
> Reported-by: kernel test robot <lkp@...el.com>
> Link: https://lore.kernel.org/oe-kbuild-all/202304031749.UiyJpxzF-lkp@intel.com/
> Signed-off-by: Steven Price <steven.price@....com>
> ---
>  fs/proc/task_mmu.c | 2 ++
>  1 file changed, 2 insertions(+)

I think it would be better to enclose the definition of
shmem_swap_usage() in its header with a stub like shmem_mapping and
remove the ifdef completely. shmem_mapping() is already compile time
false.

#ifdef CONFIG_SHMEM
        if (vma->vm_file && shmem_mapping(vma->vm_file->f_mapping)) {
                /*
                 * For shared or readonly shmem mappings we know that all
                 * swapped out pages belong to the shmem object, and we can
                 * obtain the swap value much more efficiently. For private
                 * writable mappings, we might have COW pages that are
                 * not affected by the parent swapped out pages of the shmem
                 * object, so we have to distinguish them during the page walk.
                 * Unless we know that the shmem object (or the part mapped by
                 * our VMA) has no swapped out pages at all.
                 */
                unsigned long shmem_swapped = shmem_swap_usage(vma);

                if (!start && (!shmem_swapped || (vma->vm_flags & VM_SHARED) ||
                                        !(vma->vm_flags & VM_WRITE))) {
                        mss->swap += shmem_swapped;
                } else {
                        ops = &smaps_shmem_walk_ops;
                }
        }
#endif


Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ