Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7550620rwn; Tue, 13 Sep 2022 23:57:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Lbse5+rJuXlu6dl76gORuz9nznthCVn/Cuj7aukjnxRB0h2duRQ98txWszh5hAkH/YA2O X-Received: by 2002:a65:5501:0:b0:438:ebbe:4a6c with SMTP id f1-20020a655501000000b00438ebbe4a6cmr12386040pgr.384.1663138641098; Tue, 13 Sep 2022 23:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663138641; cv=none; d=google.com; s=arc-20160816; b=fAqAZUFNtHvXF0ODic+o67O9UONOjE7JHPwl9fa9XJ2tkFbg1f3KnogIqG2lbOmSLn Wt1GXXDfIlS1ZaryjrTBGjLm1jEmudxuW0h4JCNUxodpRYMfM6mRmLWcNWHN8+vfngwS FR7wLi86rNigOXFxAmpCmAwRte63JrU1ThL9Cod27BGalVYGvv/kPGYbQIp3/7Iktnyz cNiOarEyci+0ECT+zuvMreJcoCUxZZHG4cV2USNziYVw+w5PZC6va8s6h01YFWEqPSvu p4vB9mZ5Y2y+3AH8oWvtxOOReWhNI5TAm9HOt+yxTwB269gCtC3/ruItpjTwfzz4gbP9 Kd2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=EloDAna5lEXyaf2YWCwBQT37PLo4UpLbNCIVb2NX0Y4=; b=F5Rbr/xe0aJSjm9DFB9NHo6L1bS5BNSvIYD9VWzF/kdnHIBIshHWC22nTWd+YifLXx 7lUMDW2giIokpHl3CI/POPIt/Q7qCV1rG883Q488igZzTbAItYOILhzop3nXwStmGGkK Vt7DsJitSa7ewmybidcymL74PaQHpQ2lE+C4oH1RFjWa3FDK1X+IZ3HFCbTZEDnIZGWV wyjpUQzNXHY9CnIka03/mvQhdFdpRvg97O4/Gv6LdxVdHQ9XfvdgOfD7tKPJ17h4J/QV gU/3CHnT89YtZB+WtmlVyBGEr0gO2tBAeXmTNs2kTUY6hLNMAVICRHXQyr547QC4l5q/ DvFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h38-20020a631226000000b00438e3cbe7c3si4134780pgl.664.2022.09.13.23.57.08; Tue, 13 Sep 2022 23:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbiINGFB (ORCPT + 99 others); Wed, 14 Sep 2022 02:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbiINGEy (ORCPT ); Wed, 14 Sep 2022 02:04:54 -0400 Received: from mail.nfschina.com (unknown [124.16.136.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F13BB87F; Tue, 13 Sep 2022 23:04:47 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 8D8F61E80D5E; Wed, 14 Sep 2022 14:02:31 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OSC8BRoRCd7h; Wed, 14 Sep 2022 14:02:28 +0800 (CST) Received: from localhost.localdomain (unknown [219.141.250.2]) (Authenticated sender: zeming@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id BAA481E80D58; Wed, 14 Sep 2022 14:02:28 +0800 (CST) From: Li zeming To: James.Bottomley@HansenPartnership.com, deller@gmx.de Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Li zeming Subject: [PATCH] parisc: Increase the usage check of kmalloc allocated object a Date: Wed, 14 Sep 2022 14:04:28 +0800 Message-Id: <20220914060428.4039-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,MAY_BE_FORGED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the case of memory allocation failure, no alignment operation is required. Signed-off-by: Li zeming --- drivers/parisc/iosapic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 3a8c98615634..33de438916d3 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -229,7 +229,9 @@ static struct irt_entry *iosapic_alloc_irt(int num_entries) * 4-byte alignment on 32-bit kernels */ a = (unsigned long)kmalloc(sizeof(struct irt_entry) * num_entries + 8, GFP_KERNEL); - a = (a + 7UL) & ~7UL; + if (a) + a = (a + 7UL) & ~7UL; + return (struct irt_entry *)a; } -- 2.18.2