powerpc/vio: use strcpy in modalias_show
authorPrarit Bhargava <prarit@redhat.com>
Thu, 17 Oct 2013 12:00:11 +0000 (08:00 -0400)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 30 Oct 2013 05:00:57 +0000 (16:00 +1100)
Commit e82b89a6f19bae73fb064d1b3dd91fcefbb478f4 used strcat instead of
strcpy which can result in an overflow of newlines on the buffer.

Signed-off-by: Prarit Bhargava
Cc: benh@kernel.crashing.org
Cc: ben@decadent.org.uk
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/vio.c

index d38cc08b16c7f23831e3af558bfe35908e14af47..cb92d8204ec79f4e002d694cfc450844952f090f 100644 (file)
@@ -1531,12 +1531,12 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 
        dn = dev->of_node;
        if (!dn) {
-               strcat(buf, "\n");
+               strcpy(buf, "\n");
                return strlen(buf);
        }
        cp = of_get_property(dn, "compatible", NULL);
        if (!cp) {
-               strcat(buf, "\n");
+               strcpy(buf, "\n");
                return strlen(buf);
        }