All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: Tina Zhang <tina.zhang@intel.com>, iommu@lists.linux.dev
Cc: baolu.lu@linux.intel.com, Yongwei Ma <yongwei.ma@intel.com>
Subject: Re: [PATCH 2/4] iommu/vt-d: Fix operand size in bitwise operation
Date: Wed, 29 Mar 2023 21:32:43 +0800	[thread overview]
Message-ID: <5315d7ee-48f4-6810-72c5-9066aa456c24@linux.intel.com> (raw)
In-Reply-To: <20230329124654.2698853-3-tina.zhang@intel.com>

On 2023/3/29 20:46, Tina Zhang wrote:
> The patch fixes the klocwork issues that operands in a bitwise operation have
> different size at line 1692 of dmar.c, line 1898 and line 1907 of iommu.c.
> 
> Reported-by: Yongwei Ma <yongwei.ma@intel.com>
> Signed-off-by: Tina Zhang <tina.zhang@intel.com>
> ---
>   drivers/iommu/intel/dmar.c  | 2 +-
>   drivers/iommu/intel/iommu.c | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
> index 6acfe879589c..7c77a59889ea 100644
> --- a/drivers/iommu/intel/dmar.c
> +++ b/drivers/iommu/intel/dmar.c
> @@ -1689,7 +1689,7 @@ static void __dmar_enable_qi(struct intel_iommu *iommu)
>   	 * is present.
>   	 */
>   	if (ecap_smts(iommu->ecap))
> -		val |= (1 << 11) | 1;
> +		val |= (1ull << 11) | 1ull;

How about BIT_ULL(11) | BIT_ULL(0)?

Ditto to other changes.

Best regards,
baolu

>   
>   	raw_spin_lock_irqsave(&iommu->register_lock, flags);
>   
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index 7c2f4bd33582..085d31a77f6f 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -1895,7 +1895,7 @@ context_set_sm_rid2pasid(struct context_entry *context, unsigned long pasid)
>    */
>   static inline void context_set_sm_dte(struct context_entry *context)
>   {
> -	context->lo |= (1 << 2);
> +	context->lo |= (1ull << 2);
>   }
>   
>   /*
> @@ -1904,7 +1904,7 @@ static inline void context_set_sm_dte(struct context_entry *context)
>    */
>   static inline void context_set_sm_pre(struct context_entry *context)
>   {
> -	context->lo |= (1 << 4);
> +	context->lo |= (1ull << 4);
>   }
>   
>   /* Convert value to context PASID directory size field coding. */


  reply	other threads:[~2023-03-29 13:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 12:46 [PATCH 0/4] iommu/vt-d: Several fixes for intel iommu driver Tina Zhang
2023-03-29 12:46 ` [PATCH 1/4] iommu/vt-d: Fix null pointer access in invalidate_range callback Tina Zhang
2023-03-29 13:30   ` Baolu Lu
2023-03-29 13:40     ` Zhang, Tina
2023-03-29 13:51       ` Baolu Lu
2023-03-29 12:46 ` [PATCH 2/4] iommu/vt-d: Fix operand size in bitwise operation Tina Zhang
2023-03-29 13:32   ` Baolu Lu [this message]
2023-03-29 13:44     ` Zhang, Tina
2023-03-29 12:46 ` [PATCH 3/4] iommu/vt-d: Fix quoted string split across lines Tina Zhang
2023-03-29 13:38   ` Baolu Lu
2023-03-29 23:40     ` Zhang, Tina
2023-03-29 12:46 ` [PATCH 4/4] iommu/vt-d: Replace BUG()/BUG_ON() with WARN_ON/WARN_ON_ONCE() Tina Zhang
2023-03-29 13:40   ` Baolu Lu

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=5315d7ee-48f4-6810-72c5-9066aa456c24@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=tina.zhang@intel.com \
    --cc=yongwei.ma@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.