Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751556AbdISR2A (ORCPT ); Tue, 19 Sep 2017 13:28:00 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:33315 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750733AbdISR16 (ORCPT ); Tue, 19 Sep 2017 13:27:58 -0400 X-Google-Smtp-Source: AOwi7QAKOYT4jVtfMo0eHRjUifM+vM5rGfpOcSfmjaSoxvzxDJjoORiZ4sRzUcmePFnvU7d3ddhXtw== Date: Tue, 19 Sep 2017 12:27:56 -0500 From: Rob Herring To: Geert Uytterhoeven Cc: Pantelis Antoniou , Frank Rowand , Grant Likely , Arnd Bergmann , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] of: overlay: Fix uninitialized vars in dup_and_fixup_symbol_prop() Message-ID: <20170919172756.3fsud4g4grracxqt@rob-hp-laptop> References: <1505039164-25468-1-git-send-email-geert@linux-m68k.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1505039164-25468-1-git-send-email-geert@linux-m68k.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1122 Lines: 28 On Sun, Sep 10, 2017 at 12:26:04PM +0200, Geert Uytterhoeven wrote: > With gcc 4.1.2: > > drivers/of/overlay.c: In function ‘dup_and_fixup_symbol_prop’: > drivers/of/overlay.c:108: warning: ‘overlay_name_len’ may be used uninitialized in this function > drivers/of/overlay.c:100: warning: ‘ovinfo’ may be used uninitialized in this function > > Indeed, if ov->count == 0, both variables are uninitialized, which may > lead to a crash when dereferencing ovinfo later. > > Currently this is a false positive, as the sole creator of of_overlay > structures (of_build_overlay_info(), introduced in commit > 7518b5890d8ac366 ("of/overlay: Introduce DT overlay support") checks for > this. > > To prevent future issues, add a check for a zero ov->count to > dup_and_fixup_symbol_prop(). Note that this does not get rid of the > actual compiler warning. > > Fixes: d1651b03c2df75db ("of: overlay: add overlay symbols to live device tree") > Signed-off-by: Geert Uytterhoeven > --- > drivers/of/overlay.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied. Rob