LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] tools: PCI: Zero-initialize param
@ 2021-07-14 13:23 Shunyong Yang
  2021-07-14 13:32 ` Kishon Vijay Abraham I
  2021-08-05 10:02 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 4+ messages in thread
From: Shunyong Yang @ 2021-07-14 13:23 UTC (permalink / raw)
  To: bhelgaas, kishon, lorenzo.pieralisi, kw, leon
  Cc: linux-pci, linux-kernel, Shunyong Yang

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] tools: PCI: Zero-initialize param
  2021-07-14 13:23 [PATCH v2] tools: PCI: Zero-initialize param Shunyong Yang
@ 2021-07-14 13:32 ` Kishon Vijay Abraham I
  2021-08-03 11:48   ` Shunyong Yang
  2021-08-05 10:02 ` Lorenzo Pieralisi
  1 sibling, 1 reply; 4+ messages in thread
From: Kishon Vijay Abraham I @ 2021-07-14 13:32 UTC (permalink / raw)
  To: Shunyong Yang, bhelgaas, lorenzo.pieralisi, kw, leon
  Cc: linux-pci, linux-kernel



On 14/07/21 6:53 pm, Shunyong Yang wrote:
> 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>

Thanks for the fix.

Acked-by: Kishon Vijay Abraham I <kishon@ti.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;
>  
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] tools: PCI: Zero-initialize param
  2021-07-14 13:32 ` Kishon Vijay Abraham I
@ 2021-08-03 11:48   ` Shunyong Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Shunyong Yang @ 2021-08-03 11:48 UTC (permalink / raw)
  To: bhelgaas, lorenzo.pieralisi, kw, leon, kishon; +Cc: linux-pci, linux-kernel

Hi, Bjorn,

    Would you please help to review and put this tiny fix (for 
tools/pci/pcitest.c) in your merge queue? Kishon has acked.

Thanks.

Shunyong

On 2021/7/14 21:32, Kishon Vijay Abraham I wrote:
>
> On 14/07/21 6:53 pm, Shunyong Yang wrote:
>> 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>
> Thanks for the fix.
>
> Acked-by: Kishon Vijay Abraham I <kishon@ti.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;
>>   
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] tools: PCI: Zero-initialize param
  2021-07-14 13:23 [PATCH v2] tools: PCI: Zero-initialize param Shunyong Yang
  2021-07-14 13:32 ` Kishon Vijay Abraham I
@ 2021-08-05 10:02 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 4+ messages in thread
From: Lorenzo Pieralisi @ 2021-08-05 10:02 UTC (permalink / raw)
  To: Shunyong Yang, kw, bhelgaas, kishon, leon
  Cc: Lorenzo Pieralisi, linux-kernel, linux-pci

On Wed, 14 Jul 2021 21:23:31 +0800, Shunyong Yang wrote:
> 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.

Applied to pci/tools, thanks!

[1/1] tools: PCI: Zero-initialize param
      https://git.kernel.org/lpieralisi/pci/c/224d8031e4

Thanks,
Lorenzo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-05 10:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14 13:23 [PATCH v2] tools: PCI: Zero-initialize param Shunyong Yang
2021-07-14 13:32 ` Kishon Vijay Abraham I
2021-08-03 11:48   ` Shunyong Yang
2021-08-05 10:02 ` Lorenzo Pieralisi

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).