linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Krzysztof Wilczyński" <kw@linux.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Boqun Feng <boqun.feng@gmail.com>, Long Li <longli@microsoft.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org
Subject: [PATCH 2/3] PCI: iov: Update format string type to match variable type
Date: Fri,  8 Oct 2021 22:27:31 +0000	[thread overview]
Message-ID: <20211008222732.2868493-2-kw@linux.com> (raw)
In-Reply-To: <20211008222732.2868493-1-kw@linux.com>

Functions pci_iov_sysfs_link() and pci_iov_remove_virtfn() take
a Virtual Function (VF) ID as an integer value and then use it to
assemble the desired name for the corresponding sysfs attribute (a
symbolic link in this case).

Internally, both functions use sprintf() to create the desired attribute
name, and leverage the "%u" modifier as part of the format string used
to do so.  However, the VF ID is passed to both functions as a signed
integer type variable, which makes the variable type and format string
modifier somewhat incompatible.

Thus, change the modifier used in the format string to "%d" to better
match the variable type.

No change to functionality intended.

Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
 drivers/pci/iov.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index dafdc652fcd0..056bba3b4236 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -140,7 +140,7 @@ int pci_iov_sysfs_link(struct pci_dev *dev,
 	char buf[VIRTFN_ID_LEN];
 	int rc;
 
-	sprintf(buf, "virtfn%u", id);
+	sprintf(buf, "virtfn%d", id);
 	rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf);
 	if (rc)
 		goto failed;
@@ -322,7 +322,7 @@ void pci_iov_remove_virtfn(struct pci_dev *dev, int id)
 	if (!virtfn)
 		return;
 
-	sprintf(buf, "virtfn%u", id);
+	sprintf(buf, "virtfn%d", id);
 	sysfs_remove_link(&dev->dev.kobj, buf);
 	/*
 	 * pci_stop_dev() could have been called for this virtfn already,
-- 
2.33.0


  reply	other threads:[~2021-10-08 22:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 22:27 [PATCH 1/3] PCI: hv: Remove unnecessary integer promotion from dev_err() Krzysztof Wilczyński
2021-10-08 22:27 ` Krzysztof Wilczyński [this message]
2021-10-11 21:13   ` [PATCH 2/3] PCI: iov: Update format string type to match variable type Bjorn Helgaas
2021-10-08 22:27 ` [PATCH 3/3] PCI: Update variable type to match sscanf() format string Krzysztof Wilczyński
2021-10-12 18:47 ` [PATCH 1/3] PCI: hv: Remove unnecessary integer promotion from dev_err() Bjorn Helgaas
2021-10-13  0:43   ` Krzysztof Wilczyński

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=20211008222732.2868493-2-kw@linux.com \
    --to=kw@linux.com \
    --cc=bhelgaas@google.com \
    --cc=boqun.feng@gmail.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=sthemmin@microsoft.com \
    --cc=wei.liu@kernel.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;
as well as URLs for NNTP newsgroup(s).