From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942276AbcJ0U2K (ORCPT ); Thu, 27 Oct 2016 16:28:10 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:33790 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964776AbcJ0U2I (ORCPT ); Thu, 27 Oct 2016 16:28:08 -0400 Date: Thu, 27 Oct 2016 16:28:06 -0400 (EDT) Message-Id: <20161027.162806.122471124625949377.davem@davemloft.net> To: arnd@arndb.de Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kalmia: avoid potential uninitialized variable use From: David Miller In-Reply-To: <20161024155430.3077348-1-arnd@arndb.de> References: <20161024155430.3077348-1-arnd@arndb.de> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-7 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 27 Oct 2016 13:28:07 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u9RKSDcg010359 From: Arnd Bergmann Date: Mon, 24 Oct 2016 17:54:18 +0200 > The kalmia_send_init_packet() returns zero or a negative return > code, but gcc has no way of knowing that there cannot be a > positive return code, so it determines that copying the ethernet > address at the end of kalmia_bind() will access uninitialized > data: > > drivers/net/usb/kalmia.c: In function ˇkalmia_bind˘: > arch/x86/include/asm/string_32.h:78:22: error: ˇ*((void *)ðernet_addr+4)˘ may be used uninitialized in this function [-Werror=maybe-uninitialized] > *((short *)to + 2) = *((short *)from + 2); > ^ > drivers/net/usb/kalmia.c:138:5: note: ˇ*((void *)ðernet_addr+4)˘ was declared here > > This warning is harmless, but for consistency, we should make > the check for the return code match what the driver does everywhere > else and just progate it, which then gets rid of the warning. > > Signed-off-by: Arnd Bergmann Applied, thanks.