LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Shunyong Yang <yang.shunyong@gmail.com>
To: bhelgaas@google.com, kishon@ti.com, lorenzo.pieralisi@arm.com,
	kw@linux.com, leon@kernel.org
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shunyong Yang <yang.shunyong@gmail.com>
Subject: [PATCH v2] tools: PCI: Zero-initialize param
Date: Wed, 14 Jul 2021 21:23:31 +0800	[thread overview]
Message-ID: <20210714132331.5200-1-yang.shunyong@gmail.com> (raw)

The values in param may be random if they are not initialized, which
may cause use_dma flag set even when "-d" option is not provided
in command line. Initializing all members to 0 to solve this.

Signed-off-by: Shunyong Yang <yang.shunyong@gmail.com>
---
v2: Change {0} to {} as Leon Romanovsky's comment.
---
 tools/pci/pcitest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c
index 0a1344c45213..441b54234635 100644
--- a/tools/pci/pcitest.c
+++ b/tools/pci/pcitest.c
@@ -40,7 +40,7 @@ struct pci_test {
 
 static int run_test(struct pci_test *test)
 {
-	struct pci_endpoint_test_xfer_param param;
+	struct pci_endpoint_test_xfer_param param = {};
 	int ret = -EINVAL;
 	int fd;
 
-- 
2.25.1


             reply	other threads:[~2021-07-14 13:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 13:23 Shunyong Yang [this message]
2021-07-14 13:32 ` Kishon Vijay Abraham I
2021-08-03 11:48   ` Shunyong Yang
2021-08-05 10:02 ` Lorenzo Pieralisi

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=20210714132331.5200-1-yang.shunyong@gmail.com \
    --to=yang.shunyong@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=kishon@ti.com \
    --cc=kw@linux.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --subject='Re: [PATCH v2] tools: PCI: Zero-initialize param' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).