All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Wiederhake <twied@gmx.net>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 7/8] Always use width in scanf
Date: Mon, 16 Jul 2012 16:02:51 +0200	[thread overview]
Message-ID: <1342447372-21742-7-git-send-email-twied@gmx.net> (raw)
In-Reply-To: <1342447372-21742-1-git-send-email-twied@gmx.net>

---
 tests/modetest/modetest.c |    8 ++++----
 xf86drm.c                 |    8 ++++----
 xf86drmMode.c             |    2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index dff40d1..4540aa0 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -1215,10 +1215,10 @@ int main(int argc, char **argv)
 			break;
 		case 's':
 			con_args[count].crtc = -1;
-			if (sscanf(optarg, "%d:%64s",
+			if (sscanf(optarg, "%20d:%64s",
 				   &con_args[count].id,
 				   con_args[count].mode_str) != 2 &&
-			    sscanf(optarg, "%d@%d:%64s",
+			    sscanf(optarg, "%20d@%20d:%64s",
 				   &con_args[count].id,
 				   &con_args[count].crtc,
 				   con_args[count].mode_str) != 3)
@@ -1227,12 +1227,12 @@ int main(int argc, char **argv)
 			break;
 		case 'P':
 			strcpy(plane_args[plane_count].format_str, "XR24");
-			if (sscanf(optarg, "%d:%dx%d@%4s",
+			if (sscanf(optarg, "%20d:%20dx%20d@%4s",
 					&plane_args[plane_count].con_id,
 					&plane_args[plane_count].w,
 					&plane_args[plane_count].h,
 					plane_args[plane_count].format_str) != 4 &&
-				sscanf(optarg, "%d:%dx%d",
+				sscanf(optarg, "%20d:%20dx%20d",
 					&plane_args[plane_count].con_id,
 					&plane_args[plane_count].w,
 					&plane_args[plane_count].h) != 3)
diff --git a/xf86drm.c b/xf86drm.c
index 94f634d..bcb9fbf 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -224,18 +224,18 @@ static int drmMatchBusID(const char *id1, const char *id2, int pci_domain_ok)
 	unsigned int o2, b2, d2, f2;
 	int ret;
 
-	ret = sscanf(id1, "pci:%04x:%02x:%02x.%u", &o1, &b1, &d1, &f1);
+	ret = sscanf(id1, "pci:%04x:%02x:%02x.%20u", &o1, &b1, &d1, &f1);
 	if (ret != 4) {
 	    o1 = 0;
-	    ret = sscanf(id1, "PCI:%u:%u:%u", &b1, &d1, &f1);
+	    ret = sscanf(id1, "PCI:%20u:%20u:%20u", &b1, &d1, &f1);
 	    if (ret != 3)
 		return 0;
 	}
 
-	ret = sscanf(id2, "pci:%04x:%02x:%02x.%u", &o2, &b2, &d2, &f2);
+	ret = sscanf(id2, "pci:%04x:%02x:%02x.%20u", &o2, &b2, &d2, &f2);
 	if (ret != 4) {
 	    o2 = 0;
-	    ret = sscanf(id2, "PCI:%u:%u:%u", &b2, &d2, &f2);
+	    ret = sscanf(id2, "PCI:%20u:%20u:%20u", &b2, &d2, &f2);
 	    if (ret != 3)
 		return 0;
 	}
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 04fdf1f..31b5abd 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -693,7 +693,7 @@ int drmCheckModesettingSupported(const char *busid)
 	struct dirent *dent;
 	int found = 0, ret;
 
-	ret = sscanf(busid, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev, &func);
+	ret = sscanf(busid, "pci:%04x:%02x:%02x.%20d", &domain, &bus, &dev, &func);
 	if (ret != 4)
 		return -EINVAL;
 
-- 
1.7.10.4

  parent reply	other threads:[~2012-07-16 14:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-16 14:02 [PATCH 1/8] Silence function defined but not used warning Tim Wiederhake
2012-07-16 14:02 ` [PATCH 2/8] Remove unused variables Tim Wiederhake
2012-07-16 14:02 ` [PATCH 3/8] Cleanup includes Tim Wiederhake
2012-07-16 14:02 ` [PATCH 4/8] Fix memory leaks Tim Wiederhake
2012-07-16 14:02 ` [PATCH 5/8] Fix possible null pointer dereferences Tim Wiederhake
2012-07-16 14:02 ` [PATCH 6/8] Remove never used assignments Tim Wiederhake
2012-07-16 14:02 ` Tim Wiederhake [this message]
2012-07-16 14:02 ` [PATCH 8/8] Update .gitignore Tim Wiederhake

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=1342447372-21742-7-git-send-email-twied@gmx.net \
    --to=twied@gmx.net \
    --cc=dri-devel@lists.freedesktop.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.