Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp449910imm; Thu, 6 Sep 2018 05:14:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZBN31CoiB+mw8duMGTVNkedkVQ52ZDH9VXzTpD+DQmXCRnY1VXw2TiL3ybMhvUrTfBs5tB X-Received: by 2002:a17:902:8605:: with SMTP id f5-v6mr2260041plo.271.1536236065245; Thu, 06 Sep 2018 05:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536236065; cv=none; d=google.com; s=arc-20160816; b=uT9d5qWuYqzgWUFmqpX1ibUgjzG+/luNv7HSQHs9l0dkh18yGB0Z6rcFTBHMyAxAQR jIjL9oQJ9P3+6ahIha0cAx+BZANNxWx0evVAWmIlwihtvLyKLIrbqaMFGeTQMw8369Ol qLIuUGWtj7z5gxGyVpFWU4GbZJ5z6KlZX4Qy/tCaeGdk5Pg6Aw70JVA25+ilG8s0QAhn TfLKOSLI/vuBANQlzjdPRqakKIUscVZeN6IEqx/l4diCBruHGLI+LJTA4y1k9NmXR2TY LE1+lexavMsIbpDXfZg4gDaALsUyBCNccOOs7yqQbVzSN9FOtV7qlG4OFo+dYuKhI8DE 1scA== 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 :dkim-signature; bh=hAQltCDob1QT626+UKow4KSqmQCSsrkxJvuvO272vb0=; b=Q7XJdCjLXQ7D2bXWQ21AeXEXkdtnf3qPFWARFTXvDnJo5kvIpaUsniiMid8fixCuGM vwPaQO1ptLImbe2IT9eeTYlV+j34ud3TY9aysFIIPUz7+NBE3/n7nceg0HmwTpf8IlY+ +bJhsMEs7pKq3bBiwjU03U/Eep+WfXK2Tr4wFW2KU8SQImTRbqEMXdCP5V+HklaTPI28 m9sL/wD7+YmrZBT0TkPFdRKvzfle2cJzhCgTwf3oGAysth+tpEfaO6IE3Q3yo+piMduJ IxdmYT6qVEIgWkA19i56Z4GZ0GiDZQ0O8rqVkyWU24/lRV6fMm3MF8gXQC3FZThI5pyq yH8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=humain+2; 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 t127-v6si5212799pfc.118.2018.09.06.05.14.09; Thu, 06 Sep 2018 05:14:25 -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; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=humain+2; 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 S1727997AbeIFQro (ORCPT + 99 others); Thu, 6 Sep 2018 12:47:44 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:51240 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbeIFQro (ORCPT ); Thu, 6 Sep 2018 12:47:44 -0400 Received: by mail-wm0-f67.google.com with SMTP id y2-v6so11185283wma.1 for ; Thu, 06 Sep 2018 05:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=hAQltCDob1QT626+UKow4KSqmQCSsrkxJvuvO272vb0=; b=humain+2xZy441dmpqZhn4rerDs+bhxkgBZo8FM3GX1Kj+T8c3iZNFOszIPAI/3VGU l8KbfNg6UScAJ0LLUFw2vW4IXV66d89sFJEBwSrhsNVBzHVvraaLaJyY0QEaRyn/bQcF oTV7V0Qx/MzbtmUQDet8aIY/H+YotcI5FMmeo3ZFgB8ob82vWqP2qabrfO1JOkw/eOOS /IbJ15piia+Gbkv/i/NM2+BLPJJnLMCAuWDHk3vA7nTBfW+jOsqHbNm3x5CGGwxqpI/b R2TZZkjCOxPOnTAp/5hMpT6LZWFnTkv7XG5f4hJgJoUPkfQECbT8rYtUAJjoQds0+kQg yOQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hAQltCDob1QT626+UKow4KSqmQCSsrkxJvuvO272vb0=; b=IMA3OtsWjlv921YVqnZqqT+X6vUovCrw5R7iWQLlk2mo571i4EYWhmqGRn8bX6Ym5x 5gNwqbBzCE55GjFsxPeyevP0btImoRLL/o2T428IX/r9QX3s8dKOSrj/H8sUstJttyew EbkHHXGweUz42xITS9GqV71DaUwC0scW9cT3yFL84XiHj52BZ1VyfNqdyuQeGR4ts9pv 94Xp0afaNjpUIkOu22fg1DkmBiy56reKrTnniQdDIMij6y32NQTSLaTYdEBhnxAEPJoM TdeFt6NlKQ74KaF8jjBy2xFNvdCnr8sMamLngdHs2n/w7lVpbX1ULnzFHjiVF2xkVM5T 3ZLA== X-Gm-Message-State: APzg51DX6L7sJS2tnAzfIHDLrbarM1kJ5HPcOHJpHvdh7SxMoPB7QSyK ++Vmeqkr+VLfxZwWrtj/kUZroA== X-Received: by 2002:a1c:82c8:: with SMTP id e191-v6mr1858952wmd.35.1536235951353; Thu, 06 Sep 2018 05:12:31 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id h15-v6sm2922770wmb.21.2018.09.06.05.12.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 05:12:30 -0700 (PDT) From: Bartosz Golaszewski To: Santosh Shilimkar , Sekhar Nori , Kevin Hilman , Dan Carpenter Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , stable@vger.kernel.org Subject: [PATCH] memory: ti-aemif: fix a potential NULL-pointer dereference Date: Thu, 6 Sep 2018 14:12:19 +0200 Message-Id: <20180906121219.23948-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski Platform data pointer may be NULL. We check it everywhere but in one place. Fix it. Fixes: 8af70cd2ca50 ("memory: aemif: add support for board files") Reported-by: Dan Carpenter Signed-off-by: Bartosz Golaszewski Cc: stable@vger.kernel.org --- drivers/memory/ti-aemif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index 31112f622b88..475e5b3790ed 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c @@ -411,7 +411,7 @@ static int aemif_probe(struct platform_device *pdev) if (ret < 0) goto error; } - } else { + } else if (pdata) { for (i = 0; i < pdata->num_sub_devices; i++) { pdata->sub_devices[i].dev.parent = dev; ret = platform_device_register(&pdata->sub_devices[i]); -- 2.18.0