All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yizhuo Zhai <yzhai003-3vSkeFsW7jA@public.gmane.org>
To: joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Chengyu Song <csong-OqvYMq7jYtE3uPMLIKxrzw@public.gmane.org>,
	Zhiyun Qian <zhiyunq-OqvYMq7jYtE3uPMLIKxrzw@public.gmane.org>
Subject: [patch] /drivers/iommu/amd_iommu.c: variable unmap_size could be uninitialized
Date: Wed, 30 May 2018 23:02:54 -0700	[thread overview]
Message-ID: <CABvMjLS3xMmMCSk4Y9Q1rd3398B4kqRi69mn7igPzx6Kt=83cw@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 992 bytes --]

Variable "unmap_size" is supposed to be initialized in function fetch_pte.
However, it's uninitialized if fetch_pte returns NULL. And "unmap_size" is
used outside the return check.

>From 377ccb647d3c6c6747f20a242b035bafc775c3be Mon Sep 17 00:00:00 2001

Signed-off-by: From: "yzhai003-3vSkeFsW7jA@public.gmane.org" <yzhai003-3vSkeFsW7jA@public.gmane.org>
---
 drivers/iommu/amd_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 8fb8c73..774e057 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1500,7 +1500,7 @@ static unsigned long iommu_unmap_page(struct
protection_domain *dom,
       unsigned long page_size)
 {
  unsigned long long unmapped;
- unsigned long unmap_size;
+ unsigned long unmap_size = 0;
  u64 *pte;

  BUG_ON(!is_power_of_2(page_size));
-- 
2.7.4


-- 
Kind Regards,

*Yizhuo Zhai*

*Computer Science, Graduate Student*
*University of California, Riverside *

[-- Attachment #1.2: Type: text/html, Size: 2225 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



             reply	other threads:[~2018-05-31  6:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31  6:02 Yizhuo Zhai [this message]
2018-05-31  9:44 ` [patch] /drivers/iommu/amd_iommu.c: variable unmap_size could be uninitialized Joerg Roedel
     [not found]   ` <20180531094415.GR18595-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2018-05-31 18:21     ` Yizhuo Zhai

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='CABvMjLS3xMmMCSk4Y9Q1rd3398B4kqRi69mn7igPzx6Kt=83cw@mail.gmail.com' \
    --to=yzhai003-3vskefsw7ja@public.gmane.org \
    --cc=csong-OqvYMq7jYtE3uPMLIKxrzw@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=zhiyunq-OqvYMq7jYtE3uPMLIKxrzw@public.gmane.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 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.