Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Subject: [bug report] arm64/mm: Clear PXX_TYPE_MASK and set PXD_TYPE_SECT in [pmd|pud]_mkhuge()
Date: Fri, 14 Mar 2025 13:54:01 +0300	[thread overview]
Message-ID: <d7902504-1ed4-452f-9b08-148f6b8b69fd@stanley.mountain> (raw)

Hello Anshuman Khandual,

Commit 1601df9e366e ("arm64/mm: Clear PXX_TYPE_MASK and set
PXD_TYPE_SECT in [pmd|pud]_mkhuge()") from Feb 21, 2025 (linux-next),
leads to the following (unpublished) Smatch static checker warning:

arch/arm64/include/asm/pgtable.h:587 pmd_mkhuge() warn: odd binop '0x1 & 0xfffffffffffffffe'
arch/arm64/include/asm/pgtable.h:626 pud_mkhuge() warn: odd binop '0x1 & 0xfffffffffffffffe'

arch/arm64/include/asm/pgtable.h
    579 static inline pmd_t pmd_mkhuge(pmd_t pmd)
    580 {
    581         /*
    582          * It's possible that the pmd is present-invalid on entry
    583          * and in that case it needs to remain present-invalid on
    584          * exit. So ensure the VALID bit does not get modified.
    585          */
    586         pmdval_t mask = PMD_TYPE_MASK & ~PTE_VALID;
--> 587         pmdval_t val = PMD_TYPE_SECT & ~PTE_VALID;

This is "1 & ~1".  I see the comment, but I'm too stupid to know even
after reading he comment whether it's intentional or not.  :P

    588 
    589         return __pmd((pmd_val(pmd) & ~mask) | val);
    590 }

regards,
dan carpenter


             reply	other threads:[~2025-03-14 11:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 10:54 Dan Carpenter [this message]
2025-03-14 17:52 ` [bug report] arm64/mm: Clear PXX_TYPE_MASK and set PXD_TYPE_SECT in [pmd|pud]_mkhuge() Catalin Marinas
2025-03-15  8:28   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7902504-1ed4-452f-9b08-148f6b8b69fd@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=anshuman.khandual@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox