lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160225074709.GA7333@mwanda>
Date:	Thu, 25 Feb 2016 10:47:10 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	David Airlie <airlied@...ux.ie>
Cc:	Alex Deucher <alexander.deucher@....com>,
	Maruthi Srinivas Bayyavarapu <Maruthi.Bayyavarapu@....com>,
	Jammy Zhou <Jammy.Zhou@....com>,
	Murali Krishna Vemuri <murali-krishna.vemuri@....com>,
	Chunming Zhou <david1.zhou@....com>,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: [patch] drm/amd: cleanup get_mfd_cell_dev()

It's simpler to just use snprintf() to print this to one buffer instead
of using strcpy() and strcat().  Also using snprintf() is slightly safer
than using sprintf().

Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
index 9f8cfaa..d6b0bff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
@@ -240,12 +240,10 @@ static int acp_poweron(struct generic_pm_domain *genpd)
 static struct device *get_mfd_cell_dev(const char *device_name, int r)
 {
 	char auto_dev_name[25];
-	char buf[8];
 	struct device *dev;
 
-	sprintf(buf, ".%d.auto", r);
-	strcpy(auto_dev_name, device_name);
-	strcat(auto_dev_name, buf);
+	snprintf(auto_dev_name, sizeof(auto_dev_name),
+		 "%s.%d.auto", device_name, r);
 	dev = bus_find_device_by_name(&platform_bus_type, NULL, auto_dev_name);
 	dev_info(dev, "device %s added to pm domain\n", auto_dev_name);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ