Received: by 10.223.185.116 with SMTP id b49csp2233378wrg; Thu, 22 Feb 2018 10:11:56 -0800 (PST) X-Google-Smtp-Source: AH8x22523/zhBDm7fLN2o03l4VvfBSf8F0wHBOySLTXKrKhWfOtj6rAgDNH0PTPCySqg8pUnqNRD X-Received: by 10.99.117.24 with SMTP id q24mr6267591pgc.53.1519323116045; Thu, 22 Feb 2018 10:11:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519323116; cv=none; d=google.com; s=arc-20160816; b=fEA0zCB8QBZc4Wm8+k51L3GScftC8zGLfuElBmwx+vBwf79nVMfuqFqfrP1PRGWMyh cfOUbEjxl9ICrqudpUiTpNksaYi2sxwY0u6JjpwZCsyjqjWc+HK5qBPUyEnOBSkaEtga WVCovxhpFKPui326bmVvJvP3CgVdipodZX5xqFJObcRtfPFlwrEjlZnXeRcShXRyb5Zt UrcrjsBn0kLgNhnB1LlxkSf3aKneodSTF75iEpNOgKWX8AyxjSl962B8mqvSPPrtwAFC nNEGwBpz5h6RFN/PSs6Cf0ALA8ZlQwFokO2Htv9qZIDaTRqGqbG9iEDelm6DZsA7uSgL SL7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=aUY/+vYETFu794dZX4nl7BtJnFqStoAR1CvTTOVchPQ=; b=TPJM9C1zuKbhkMVtkO2ESxOlrqLy/+wkAEBuVJRDEcCmp/PJv59z2DO/3oOx93FOXJ cKleUkiMvAphs0EKb+Wq+gU5T2s8GGhflu3Q9O4eOkl3iUuy9PvqtD+AbkWGVI5/Lx/0 4LaBZUMnTmg1YQJFBswQos2F7u+RdpVKoB/kFnMi2XTTWVOaLomH5F+la1WUS4dpongM 4Gy0hwIZsJU1Fg7CTA2RsXenlJHU6UPZB7ng1mBonmYtMjxJ2d6M7nMvAvWQA9ngbhtc 47hRpi5pDQ5zSsiHFsXg4wBm741lU8dpi6FLo17DtjQK1oyrkgUhCKcLHsG8WHhoBKuR tD1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=RfITQefk; 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 z6si337132pgn.46.2018.02.22.10.11.40; Thu, 22 Feb 2018 10:11:55 -0800 (PST) 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=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=RfITQefk; 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 S933613AbeBVSKh (ORCPT + 99 others); Thu, 22 Feb 2018 13:10:37 -0500 Received: from mail-dm3nam03on0062.outbound.protection.outlook.com ([104.47.41.62]:9673 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933441AbeBVSKf (ORCPT ); Thu, 22 Feb 2018 13:10:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=aUY/+vYETFu794dZX4nl7BtJnFqStoAR1CvTTOVchPQ=; b=RfITQefkqmO/wWozCJJrXM0AHHMN00kn2xotiy7ldVO0ygvRCb6xnSWs+ACtlocVs2C+wWWiaVBbDLXsaOAr8L6+dWuMXfNLo7Su1lHFgKhfqVR1s+CijBStFDnI8Ka0wMAd5qahK6aAl9ONmNy5icZIOf1r/SKlh/2k/oP5wzQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=David.Daney@cavium.com; Received: from ddl.caveonetworks.com (50.233.148.156) by BN6PR07MB3169.namprd07.prod.outlook.com (10.172.105.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Thu, 22 Feb 2018 18:10:32 +0000 Subject: Re: [PATCH] MIPS: OCTEON: irq: check for null return on kzalloc allocation To: Colin King , Ralf Baechle , James Hogan , "Steven J . Hill" , David Daney , linux-mips@linux-mips.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180222180853.11505-1-colin.king@canonical.com> From: David Daney Message-ID: Date: Thu, 22 Feb 2018 10:10:30 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180222180853.11505-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: BYAPR07CA0018.namprd07.prod.outlook.com (52.135.222.31) To BN6PR07MB3169.namprd07.prod.outlook.com (10.172.105.139) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4cb65caf-91d8-49a8-0984-08d57a1f90f1 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:BN6PR07MB3169; X-Microsoft-Exchange-Diagnostics: 1;BN6PR07MB3169;3:oZoA+VlX6MvGPmq2H4ElBxyGBMRMWuFC1B++aJFLiD75rtS5uOO7pneAiopbTPXYzgIG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wsN+wrnyKrs8M6rcl2r8jKKJsIwfoyjS6C/SalK9U2mbzHbtFPsGQBi4uKJ5AKOolro27CQ08FHrft8b1JjJ5O+rYoYtAtGazpur842eVoZ6DodcpRexC9aTjbEyTfAUmCR9YvlhTMi3c7hmqkSL9LwcuFYQtD6DOV1sxV/Wd1eNROXjBAzzuWZW4QuiybWyAI/dy/iG6a4cQePbav+jbujdGq30mAjJD3yLGv0MuKP6o2gF8KFYCkBWCMJj46ZanC4IXpSaChST5QLHEsLKjRZ8DV6H37wBZEi1ZO0tofToQZ86WMkl+qWR2G423wY4R9aozkxT2iIaBNpTQhXPRTVmjxAuGdRYxbGqCuyrzMxI+DH7aU0LMUGpCQls=;4:c0sSNiWNVUNAxp7W6j6aFIwbpd1jzcECSS4ReEy9qST94Q4XKEwqtWETtGpuL8ihNr+tfm1HSdq7Dob4R8eJCEQHSFSTJRIDT2b+pcJ9+0pULbyyl1hec/3XMCTwTRiR5SATy0Yj+bii2IfNhONwzC5Vr1Djcg6l5BY73gNji6/tA9Yi59JV72egqARQocKk5ZvNRQ5Se4xsCTYxXKKKojlywnjbBy5blb76rZgcmRw8RjWRwiUtemJ8K5PrvsiMi7sOyapccH3P9Ts6Uanmy2oUak5tzcQPAViU5qtEckVgCABSTyqzXC8C+6QbyrsY X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(198206253151910); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001082)(6040501)(2401047)(8121501046)(5005006)(3231101)(944501161)(10201501046)(93006095)(3002001)(6041288)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:BN6PR07MB3169;BCL:0;PCL:0;RULEID:;SRVR:BN6PR07MB3169; X-Forefront-PRVS: 059185FE08 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39380400002)(376002)(346002)(366004)(396003)(39860400002)(199004)(189003)(16526019)(186003)(26005)(8676002)(81166006)(81156014)(47776003)(8936002)(2950100002)(42882006)(65826007)(76176011)(5660300001)(229853002)(53546011)(72206003)(230700001)(3846002)(6116002)(6506007)(67846002)(386003)(2906002)(52116002)(69596002)(2486003)(36756003)(52146003)(6246003)(53416004)(31686004)(106356001)(4326008)(478600001)(25786009)(6486002)(23676004)(31696002)(68736007)(7736002)(53936002)(64126003)(58126008)(66066001)(316002)(6512007)(110136005)(97736004)(105586002)(305945005)(65806001)(65956001)(59450400001)(50466002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR07MB3169;H:ddl.caveonetworks.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjA3TUIzMTY5OzIzOk1RVFhDZlQ0eklFQ2xhNmd5eit2Mis3a3Jk?= =?utf-8?B?RHFUelpkUEZuRUpZTG9iQW1TWEVhRWppc3IvTE82em12M0RqY2xjcnlRUnFv?= =?utf-8?B?U0t3akExN0xEbGhWeWxtcGVwK0FqUWRENGtaMGZoMTI2M2ZMdHEwdXc0Z0tM?= =?utf-8?B?RDdVSGczSHI3ZmRoTXRaMFFEMU1ER0pvWHBid3dKT0ZWZ2lLUDNmOUJSK2FW?= =?utf-8?B?VkozalUvMEhGWVg0NzRVbmdMOUdSWnM2RnRuNWV3VSs3ZWdSa21vOW1yTjBV?= =?utf-8?B?M2xIb0VVelViaW1UY3hZV1RUa2FCVFV4Z1dKMjh5MmljTUJvc0FtdlY2R2l4?= =?utf-8?B?NUpyMmYvcUNrWTJ4c2F0WStCSU5xVXpFRU9pcVVHN2xGYUU0UzNRZDJjenNW?= =?utf-8?B?dkNySitPZ25EVTB3bUd4cjM3VCtnUUFXQTc3aEllRU44WjVFNURYN1R3WC9w?= =?utf-8?B?NkpkOGlpMmtTTkM1VnU3YnllekwrNENUQU10RXdYdkdNS1A5Sj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6tovsyXaEbpzmAZsN1LeiRcsVVyasJ+3mGOTy7mouV6GrN28wn3hSljGeFu4hCNmORwO/Y=;24:yT0rBZYqEm6n9lwS3tLk0mhku36zSHYExn1JiKaifj/bCoMlo0lBtbCmitd4ubxgGZ/pzLiH6+JAgz5yQmaRxC5As9nP5vyaIZsJJxUcO1s=;7:C96xJ1Wm85ctheBijXO6QqeAi4NrGtK0AP/vF+BVMxTK1JCl+3dJNP2xf50677L1VO64g3jxmxxWv7y6epoZownPM0DKTibICh3POu8vA/MWwilKXcljBUnXdC1J8EeEElZoQz/2cTBrCaYZZC6DjEg499ZXCf7JIrvWerdtihlnqlfBHKThWrrRy9nfPUN0LxxTDoUr+yYK9Og/hv9W86if0Nch9H5HNGLZqDZ48rGvJO6U7hkZlsJ2jFGQnIHc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2018 18:10:32.9896 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4cb65caf-91d8-49a8-0984-08d57a1f90f1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3169 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/22/2018 10:08 AM, Colin King wrote: > From: Colin Ian King > > The allocation of host_data is not null checked, leading to a > null pointer dereference if the allocation fails. Fix this by > adding a null check and return with -ENOMEM. > > Fixes: 64b139f97c01 ("MIPS: OCTEON: irq: add CIB and other fixes") > Signed-off-by: Colin Ian King Acked-by: David Daney > --- > arch/mips/cavium-octeon/octeon-irq.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c > index b993d9f2c9b9..203e1d2a56d5 100644 > --- a/arch/mips/cavium-octeon/octeon-irq.c > +++ b/arch/mips/cavium-octeon/octeon-irq.c > @@ -2277,6 +2277,8 @@ static int __init octeon_irq_init_cib(struct device_node *ciu_node, > } > > host_data = kzalloc(sizeof(*host_data), GFP_KERNEL); > + if (!host_data) > + return -ENOMEM; > raw_spin_lock_init(&host_data->lock); > > addr = of_get_address(ciu_node, 0, NULL, NULL); >