From patchwork Wed Jan 27 18:13:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 8141021 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8925A9F9E8 for ; Wed, 27 Jan 2016 20:24:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A956F20265 for ; Wed, 27 Jan 2016 20:24:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 680F1201CD for ; Wed, 27 Jan 2016 20:24:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934924AbcA0UYy (ORCPT ); Wed, 27 Jan 2016 15:24:54 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54864 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965204AbcA0TGl (ORCPT ); Wed, 27 Jan 2016 14:06:41 -0500 Received: from localhost (unknown [104.135.8.89]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 06F981131; Wed, 27 Jan 2016 19:06:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Purdie , Jiri Kosina , linux-input@vger.kernel.org, Darren Hart , Jiri Kosina Subject: [PATCH 4.3 150/157] HID: core: Avoid uninitialized buffer access Date: Wed, 27 Jan 2016 10:13:37 -0800 Message-Id: <20160127180940.616436007@linuxfoundation.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <20160127180932.533735338@linuxfoundation.org> References: <20160127180932.533735338@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 4.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Richard Purdie commit 79b568b9d0c7c5d81932f4486d50b38efdd6da6d upstream. hid_connect adds various strings to the buffer but they're all conditional. You can find circumstances where nothing would be written to it but the kernel will still print the supposedly empty buffer with printk. This leads to corruption on the console/in the logs. Ensure buf is initialized to an empty string. Signed-off-by: Richard Purdie [dvhart: Initialize string to "" rather than assign buf[0] = NULL;] Cc: Jiri Kosina Cc: linux-input@vger.kernel.org Signed-off-by: Darren Hart Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1611,7 +1611,7 @@ int hid_connect(struct hid_device *hdev, "Multi-Axis Controller" }; const char *type, *bus; - char buf[64]; + char buf[64] = ""; unsigned int i; int len; int ret;