From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BAC5C433F5 for ; Sat, 26 Feb 2022 04:25:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229708AbiBZE0N (ORCPT ); Fri, 25 Feb 2022 23:26:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbiBZE0L (ORCPT ); Fri, 25 Feb 2022 23:26:11 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 321D1D21D7 for ; Fri, 25 Feb 2022 20:25:38 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id a5so5570141pfv.9 for ; Fri, 25 Feb 2022 20:25:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=Fp8tS9Tv9uCsWH6vrg9RydV37obfExfUsNqz1M7URQw=; b=gAwNByTQb9WAk7MPfXqU6n8mq0gTMsBg0s07UhnpFy7iVZ7BGyO+fcZMiq1ckGgeST SPtN9ABVZSGJUMpwJiBgmjb+llU2FOqn0orQ/CM2hYu0upRAEc2AskxGiAkuDR4dueZ6 GJuPYwt12mV9VHyCAbc8ZEANweruJ4SFj+zHNZm9O4vugdXzlJxPh4sr/NbtEfZ7P33y T7VPH9en9aAAkmXGot0rJkeLIZVA+jiz6x6dR5mZG8Vp0iPTcO01F70AHcHv1i3H8x2w Ht6uKu3tQ3anzoNnJ4B7D+yHxVA7G6VItDpJ+RYNo81rSW6HsGDolLaQIgap2L21yttM qy/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=Fp8tS9Tv9uCsWH6vrg9RydV37obfExfUsNqz1M7URQw=; b=fsp9eBzO91N9BG0L2gsKUTNJhxx1uPPqUB/NjfNIWs3gzaWryc4qsTTdtngzzp/5zb kx6Fco8jG9nbdA1B9lA34HYwzmSNwTc5ZHPWCIngcK17RCSCiX4lgnNytAHk+EOcXI3P /Pqmj40Xo/tTVHznEQ2a63u6XZ4tnHmYAEf4PMqz7cl8KkFQ1duVuRo+fzQdaCKdNkDB jmS+82RIv/d+RcuzzGx28vzwhJUzIKP482dUGLGIM1+1NrMxKkzI+FqP9yaOURw8VPpH XUOlPDaelpF8CnIuVirYTe32bBTtNwh6TWr7G6DYT4g1zjUI/p2PPpdVXMoFVeLUUXyX ZKqw== X-Gm-Message-State: AOAM533eHvbO5ZuVQrQuCwjWlgWQFPRrLNgUyINqnN30j820+vsfv+2J 7I4iK7GF2WAAZ1P6cPE3kvPQl3/Qv7wXMBm1 X-Google-Smtp-Source: ABdhPJzHQLmT4p//evrcfBLw6x6Xobkv89wYpaBw12Jpf3R4cHoxj+UYFlNw9jxJJ4iXYg8goHDYUA== X-Received: by 2002:a63:2d05:0:b0:34b:3f1d:2fa8 with SMTP id t5-20020a632d05000000b0034b3f1d2fa8mr8844216pgt.447.1645849537593; Fri, 25 Feb 2022 20:25:37 -0800 (PST) Received: from mail.google.com (122-58-164-114-fibre.sparkbb.co.nz. [122.58.164.114]) by smtp.gmail.com with ESMTPSA id z8-20020aa79588000000b004e1dc67ead3sm4783050pfj.126.2022.02.25.20.25.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 20:25:37 -0800 (PST) Date: Sat, 26 Feb 2022 17:25:31 +1300 From: Paulo Miguel Almeida To: gregkh@linuxfoundation.org, paulo.miguel.almeida.rodenas@gmail.com, realwakka@gmail.com Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] staging: pi433: prevent uninitialized data from being printed out Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org local_buffer is not initialised before data is passed to spi_sync_transfer. In case spi* function fails then the dev_dbg statement after that can potentially print out uninitialised data this patch initialises local_buffer array. Signed-off-by: Paulo Miguel Almeida --- Meta-comments: - this change was requested by Dan Carpenter in a different thread: https://lore.kernel.org/lkml/20220207100601.GF1951@kadam/ Patch dependency: - this patch depends on the following patch to be applied first as both of them change the same file: https://lore.kernel.org/lkml/Yhla4a1Clpguoo2h@mail.google.com/ --- drivers/staging/pi433/rf69.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index e5b23ab39c69..3028018f0b45 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -782,7 +782,7 @@ int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) { int i; struct spi_transfer transfer; - u8 local_buffer[FIFO_SIZE + 1]; + u8 local_buffer[FIFO_SIZE + 1] = {}; int retval; if (size > FIFO_SIZE) { -- 2.34.1