From patchwork Tue Mar 28 07:49:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emiliano Ingrassia X-Patchwork-Id: 9648281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2931B602C8 for ; Tue, 28 Mar 2017 07:49:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1873022BF1 for ; Tue, 28 Mar 2017 07:49:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C8CD28387; Tue, 28 Mar 2017 07:49:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01D1822BF1 for ; Tue, 28 Mar 2017 07:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754541AbdC1Htf (ORCPT ); Tue, 28 Mar 2017 03:49:35 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36637 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753989AbdC1Hte (ORCPT ); Tue, 28 Mar 2017 03:49:34 -0400 Received: by mail-wr0-f193.google.com with SMTP id u1so20068539wra.3 for ; Tue, 28 Mar 2017 00:49:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=PhjvkKGvonynr1+ltkNMioOwOhzUxMbm3mOEgb/v1Ns=; b=Zqo9Hw8Bxn5sulK/sMt5rQP26pErHkKc2Vj7u+NIFUOGN7sYLEiCkKmg2Baai/xdrV haZMkzzdJ7r1J5UTPwz9IvmSdaoQyIJZbH+px+CHuZ09QzbmSVeVbzedIDR8NjY4PfsE w643GGQumJ+msvRCOJ9paxlu7K1mXCNeGkRl7CqEhvyIvOF1sVgAh9EJmEohBz+583on YNf+xoZ5nJ+cIYtNIDUI5tvDmjx68VauLTzeOsHkMlWzVu9w+CACJQ4D7Yv0V0iXDzXB O8BckCEugxdMfuLW54kwC1sU0kV9H2zau+IejCihDQ8KFaqzikzwYgmv6W3RPYLciufD eINQ== X-Gm-Message-State: AFeK/H2vNLU6aA7FNcONu4fAsZoDB+0o44wj24OYee+ir49JjXNFYfpcvd3IBd8ocCTorA== X-Received: by 10.223.172.135 with SMTP id o7mr22086294wrc.121.1490687372542; Tue, 28 Mar 2017 00:49:32 -0700 (PDT) Received: from ingrassia.epigenesys.com (93-63-241-174.ip30.fastwebnet.it. [93.63.241.174]) by smtp.gmail.com with ESMTPSA id g78sm3741528wrd.11.2017.03.28.00.49.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 00:49:31 -0700 (PDT) Date: Tue, 28 Mar 2017 09:49:29 +0200 From: Emiliano Ingrassia To: Mark Brown Cc: linux-spi@vger.kernel.org Subject: [PATCH] spi: dynamycally allocated message initialization Message-ID: <20170328074929.GA3196@ingrassia.epigenesys.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Invoke the proper function while initializing a dynamically allocated spi_message to avoid NULL pointer dereference during resources deallocation. Signed-off-by: Emiliano Ingrassia --- include/linux/spi/spi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 5a8c4b24f2dc..805878d61a8f 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -892,7 +892,7 @@ static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags unsigned i; struct spi_transfer *t = (struct spi_transfer *)(m + 1); - INIT_LIST_HEAD(&m->transfers); + spi_message_init_no_memset(m); for (i = 0; i < ntrans; i++, t++) spi_message_add_tail(t, m); }