powerpc/vio: use strcpy in modalias_show
authorPrarit Bhargava <prarit@redhat.com>
Thu, 17 Oct 2013 12:00:11 +0000 (08:00 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Nov 2013 18:50:36 +0000 (10:50 -0800)
commit 411cabf79e684171669ad29a0628c400b4431e95 upstream.

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
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/vio.c

index cfe0069bcfc8918d8d3e7e048e694a05d30bc2ba..fcf89bff1177c4f63641f158a4723a0765afaae4 100644 (file)
@@ -1342,12 +1342,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);
        }