Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1034449yba; Sat, 13 Apr 2019 22:01:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOJEUNnb686zxPACEmDKT42hOAqoLafK2jjq5y0Rbwso61phijjwJolzmBr/VXH+2wfMC0 X-Received: by 2002:a63:720e:: with SMTP id n14mr62284246pgc.93.1555218084947; Sat, 13 Apr 2019 22:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555218084; cv=none; d=google.com; s=arc-20160816; b=UtwsTOZNao9yiqkMFtBq8jvcVvtg0v6AW64XyTKaVQPhG1dFGXH7PmL4cYHSiV4iuJ egigtkX+bnrc4HuZy5jN9kJUSuoKZxhYtaKFVL6H3eS1rBpgPX8bbLSQCaq0du486OEG l5cdz28lpnshIzPg/Wqll+LpJIwQLF+7RJ3HI9AOZGBVAXEO4IR7qVPuPDr/xShSzZJw fY4gxcCfPwd+X7xfFtWlTg8kyzK+qcGG6AAfn2UpsSvJ27C1L4/APaDhX2xALNaocUi/ h6DvPB+QicEz4Aml7XTyFX0ek9TLhhq9xljag7nvtYhuVCItcBIY1MHCb1c09d/JtvQb RoCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=uen67dopferLPMixv5y3nxZxx/Qnar7iPmAQjdByT60=; b=vH3Yx3i1RquxIPvQOWLMrgV6ZlNHP4AbXDniAoWXDl6n58hovG/L6PJDsrivnxVtHP hasWV8s9ikElQ+gvIWWIbTfRddWHSG4HwSh6lhkLMUyynmHA8MHCbceaUhtd3/puLqXn OZowQgWs1kGEp8hli9uhnaKhE1KylYXWwETWqmr5ekx+fc/cYYHjOdM8pSHeAozDrIuE easX9qCXGUsYt6kYd9UokkgEBWZeD3uqN8918RTAMOhEwdZVIHfFX9ZGU8EOHycDuh1v CGPu3kc0rOE46/kXF5tk7cYTJFkJEjJfVvz0LQQCMLbeeEfgPuogx7JIp93M4C4vEMWC U7fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c71si38781757pfb.138.2019.04.13.22.01.07; Sat, 13 Apr 2019 22:01:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726296AbfDNE5C (ORCPT + 99 others); Sun, 14 Apr 2019 00:57:02 -0400 Received: from www.osadl.org ([62.245.132.105]:46580 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfDNE4y (ORCPT ); Sun, 14 Apr 2019 00:56:54 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id x3E4tDwi021036; Sun, 14 Apr 2019 06:55:14 +0200 From: Nicholas Mc Guire To: Jason Cooper Cc: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH 1/3 RFC] ARM: mvebu: at least warn on kzalloc failure Date: Sun, 14 Apr 2019 06:49:49 +0200 Message-Id: <1555217391-3552-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Although it is very unlikely that the allocation during init would fail any such failure should point to the original cause rather than waiting for a null-pointer dereference to splat. Signed-off-by: Nicholas Mc Guire --- Problem located with experimental coccinelle script While this will not really help much - but kzalloc failures should not go unhandled. Patch was compile-tested: mvebu_v7_defconfig (implies MACH_MVEBU_ANY=y) (with some unrelated sparse warnings about missing syscalls) Patch is against 5.1-rc4 (localversion-next is 20190412) arch/arm/mach-mvebu/board-v7.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index 0b10acd..37f8cb6 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c @@ -128,6 +128,7 @@ static void __init i2c_quirk(void) struct property *new_compat; new_compat = kzalloc(sizeof(*new_compat), GFP_KERNEL); + WARN_ON(!new_compat); new_compat->name = kstrdup("compatible", GFP_KERNEL); new_compat->length = sizeof("marvell,mv78230-a0-i2c"); -- 2.1.4