Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp534462pxa; Thu, 27 Aug 2020 08:51:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwifWP9zSy6T6bXiogPIVukeURb/VGZuOhXtBbTfB/ln2DZ4lqlY+uGT3w5PDOzRdF0wD4a X-Received: by 2002:a17:906:6415:: with SMTP id d21mr9290019ejm.550.1598543473627; Thu, 27 Aug 2020 08:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598543473; cv=none; d=google.com; s=arc-20160816; b=WfEXhuu9ByZhhDswtcC26K2Zm3if5XOswDS9TiVTDqRxYc/46RXjGqDcXGT1nwvpTd Fb5Zn4MHAxfrCFvpeVptdFtUY/vYne73IDqTu2LtTBHlFvhBj6MmURdvWXfqWyZ/Rx59 T9LQayhwDqZCetzpoK4vPtKUrxQn0oasIzeLzdYxeJCuneh96fKkU278a4qN5IR0ZlK3 G++hLQurZBgrE6AGho8oXt9daLDzBEUm8KXzbZL73IHtOxonoPBMP/58dfppeeFujmix 57elIwECo3PykIg7kHUj5QoWLIRFZK/hft586pVYuDN6vxeIiJslx0ZgJQC0hKj+zS0W Uy6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=rrdomRe9ld4ZpjdPuZ8o6FsWfkZTk2Hw8E9wMtsC72g=; b=TLP8pQGCwLCuGxQFuRQH8S5v1s1ZGOyOovJdjSV0x7+sXRnWQGYEGmc3w//B9ATjMw a5CxkaCcc0fpEtYt2L2YlOhx15BXBju+4gwwkaGoqcOtMMQ0Q1gAaE195iSJlxEbbGZj 3Now7tgGW2zg1ikmC0ZstkQl34W5dYlkgbcfg2I+wHljZ4XqpAVZXNfAnFolGSUp1gr4 3xOfrCklSXHtL4cSHOab/T7V25s1yuK6u5DUC7vjDZqbdISl65UKFOX/7fgQC2NHPopq kTP/cf7HM9SzYmljvEAETI5vAKQvu21GIEdBEJa/NgAizKu0JFMuj0wLHePZZ41aZUoe D4VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u7si1647180ejn.161.2020.08.27.08.50.51; Thu, 27 Aug 2020 08:51:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728035AbgH0Ptr (ORCPT + 99 others); Thu, 27 Aug 2020 11:49:47 -0400 Received: from smtprelay0076.hostedemail.com ([216.40.44.76]:40072 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727112AbgH0Ptq (ORCPT ); Thu, 27 Aug 2020 11:49:46 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 287CB8384369; Thu, 27 Aug 2020 15:49:45 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1538:1568:1593:1594:1711:1714:1730:1747:1777:1792:2198:2199:2393:2559:2562:2693:2828:3138:3139:3140:3141:3142:3622:3865:3867:3868:3871:3873:3874:4321:5007:8603:10004:10400:10848:11026:11232:11658:11914:12114:12296:12297:12740:12760:12895:13069:13311:13357:13439:14659:14721:21080:21627:21990:30054:30070:30083:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: veil31_321096a2706e X-Filterd-Recvd-Size: 1317 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf09.hostedemail.com (Postfix) with ESMTPA; Thu, 27 Aug 2020 15:49:43 +0000 (UTC) Message-ID: Subject: Re: [PATCH] udf: Use kvzalloc() in udf_sb_alloc_bitmap() From: Joe Perches To: Denis Efremov , Jan Kara Cc: linux-kernel@vger.kernel.org Date: Thu, 27 Aug 2020 08:49:41 -0700 In-Reply-To: <741486db-29e8-e24e-32c1-9559e3a76a06@linux.com> References: <20200827151923.40067-1-efremov@linux.com> <741486db-29e8-e24e-32c1-9559e3a76a06@linux.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.4-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-08-27 at 18:28 +0300, Denis Efremov wrote: > > @@ -1013,10 +1013,7 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index) > > size = sizeof(struct udf_bitmap) + > > (sizeof(struct buffer_head *) * nr_groups); > > I missed that this size is a good place to use struct_size for > overflow checking. I will send v2 instead. And you could cuddle the if (!bitmap) return NULL; by removing the blank line between the alloc and test.