Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7578096rwn; Wed, 14 Sep 2022 00:33:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR4GH/G9aPkRvYpnYdlWWGLKGbTXG1WsPTZcXn979Qp6phM+nNUK/CxLrGgKBarT6xdIAqGc X-Received: by 2002:a17:906:dc8f:b0:77f:eefe:27e8 with SMTP id cs15-20020a170906dc8f00b0077feefe27e8mr4700123ejc.601.1663140789415; Wed, 14 Sep 2022 00:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663140789; cv=none; d=google.com; s=arc-20160816; b=sIJzebiBZ2H6nZVb90+wW4kUcH4NAj71kP8Lf4+fNqGH3I1CfDUc2yOG6FqYCOKnPr FX9WV/9XsGI7wFU3hAt5AmeYamcwQrmt8EPOpU2h1jPCBpc8PA46E/cxA7ATfDxBnXWO 3kd2mZB37sy9hn0MWhMlfNYnipH0kidaGr6p8akuCkNx7PfWIuvuKshTBZYhxNIsZhuQ T0Jzie1zgGEGKQaLVDKOyqA7MY5rj2Dt8gvLfff97u/dF0icxgkuBXyBLY0F40h6nTbY uowpLVqHeXgrlZ6Lq6FT/CM3OuzFHis89b/ZVNUhmx3ihnHrQcmN1fXpIkSTSREbo3mD z/KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=s8JLYnvYQMmOzMiKHogM2GEN8b8+27ezoGztyW9uu7M=; b=IX1kDuNzI2iTLiFWhSccYXI22yK1cbAWl2AxdBV7jEH9VoHORCALGqRXt9iGMM12ai Rr8/w0kT9bFpwwSzC2wSqHBgerQfVuuHSV84d9LTJubUnKHFp/HYF6PL7Krh/dRRMaF7 JXIe5b0EAO0HJhqakvDdfjTD4Ua8fGTL/unBI3nScTD0Fvkd98x3Wcj80Bzkn2/xtPvW 5sWtY9j+pI+zNODVvSEQCTWQX12rVMvtjwKfExYzfN6q5n2G0XmtfXtsdvpsPHYqLj2f EXc6rsfLVqCqNH41PDt+lOI3IqNANueLGkeVpag1NHikeuxdZ0YMkjOvLnrFqfdFrO2n t+qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=cnMZPieF; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s19-20020a170906455300b0077d264918acsi5821514ejq.103.2022.09.14.00.32.41; Wed, 14 Sep 2022 00:33:09 -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; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=cnMZPieF; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229826AbiINGSq (ORCPT + 99 others); Wed, 14 Sep 2022 02:18:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbiINGSe (ORCPT ); Wed, 14 Sep 2022 02:18:34 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15AD57198E; Tue, 13 Sep 2022 23:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1663136304; bh=hVIAn5awenrseL8mpc+1yh9xfy2xNQVLTcdMQ1gc4fw=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=cnMZPieFRuizhOLQLmaKLrOE2btqIO/CtSnH2bxVxP2+7UWVq/TSjZZODAiFXgmnn UBvp8UzrqhRP3Iyd0J6jtsk5G3YHNhVzbeCnFSxH/K2lKEIqrcpS2ZUFiV3r6jUceY aoXsoCg+o3JE+lHJtzL2yh/DKeTK+YaL+Tqwa3js= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.20.60] ([92.116.164.250]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MrhUE-1p4L1P3xrA-00neGk; Wed, 14 Sep 2022 08:18:24 +0200 Message-ID: Date: Wed, 14 Sep 2022 08:18:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH] parisc: Increase the usage check of kmalloc allocated object a To: Li zeming , James.Bottomley@HansenPartnership.com Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220914060428.4039-1-zeming@nfschina.com> Content-Language: en-US From: Helge Deller In-Reply-To: <20220914060428.4039-1-zeming@nfschina.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:p7GIC9NaSGhRukQXbQQtIiSlvWg9k1oCybwIFLtXRBtk2Y2W6gW RFQdnCZq84pZFTDeUWntqkRHxkjluL6rEfOyxCJ0gya/5XZzN/BmhDm5ZifBvH8USR4F0LM nXulw2gSqQPiaVrbhsspFmX3uztnHuUoIdWAQZ5ztyiHzTtuEMRF/QI0BKdA39RZUrn8lML p7NoqnmxNaA4fqo7Uc2pg== X-UI-Out-Filterresults: notjunk:1;V03:K0:gpBTBjNr3jc=:SP8hao8n4jQ6YVTwqQboDN i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FMGeQtUUpDjcupcdo1NsYcRyLeXlFMQuWJ em2PivIYjE6mB/WWZzeSxlUnyG+7mTF3mGK4xXaKS35aAui147iV8pBhzxZGlbtrY4q+FsA98 FW5mET+wdpWBsa75Vy6792p/0p X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 9/14/22 08:04, Li zeming wrote: > 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_e= ntries) > * 4-byte alignment on 32-bit kernels > */ > a =3D (unsigned long)kmalloc(sizeof(struct irt_entry) * num_entries += 8, GFP_KERNEL); > - a =3D (a + 7UL) & ~7UL; > + if (a) > + a =3D (a + 7UL) & ~7UL; > + As you said, the adjustment isn't required, but it's still ok. So I think the additional "if" isn't necessary and so I'm not applying your patch. Anyway, thanks for your help to try to improve the code! Helge > return (struct irt_entry *)a; > } >