Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp38557pxb; Tue, 31 Aug 2021 14:32:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQZkRXs3d/tJSFgQ6Ud4wtqqU9b9iLKnvpJK1LCGmASjQfMpN7oEBZ1RA+066LIEVAICWF X-Received: by 2002:a05:6638:419e:: with SMTP id az30mr4845218jab.14.1630445543456; Tue, 31 Aug 2021 14:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630445543; cv=none; d=google.com; s=arc-20160816; b=D2YNqRbCIhlUoO9nA7B5iq2s/fi+a9eNQTMbjKBU5ob95XyOgleVfGLRp0Jpri7bx5 EC/pG/fN+I2nAKR4FJlLTyF5p9I+Oz6Nsf2lY0wIbymMJDpLl6jSJKpkoVzSkJCDEmWA 6S7RYHJoDBlhmvZUX3ut1R3gm/YnXyDR57wu1p88dWGb++VgS4PnvZxtrzd7YQNj+VrE C9bYRLuKfkwUwP9ZOPP7D8RND1BuBhFxbJ+mK/B67nwVZtYzHa6XLXecG8ZI+L2XxXEc yCyzHnGWyk3YF6rB7aC/Qsl2MOJiiFsaC5yx2JV0G5HQXiM0obFLXOAh/efMet0kACle vuVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RAusKbpb86Vg8k5m89yF2Mh6kI0kDJIwV1Xq0hJWA0I=; b=Luop3+82L/Zjmmo0U430kjp+w0VtNtbvpHkTsNnZ349WS/+/gGg17FDnSNdc1XTerG +s0sWKndeioh3twdBzMXRU3aRCRljXOVNcn3lLd/q3LeQk40UZDr1YTCbLpfEimgATor hwiXyiPt5YMiAlCX3DjpffzZPgKK6Z6Gg130tF/E1AGP2UikZZxWNi2SzFTFJJv9HhL3 x+zH8Ajas9gDtigOHCiQ31a4nZDvP1f7zM1uCkrh4Et+NCGiK7AcyKtK+W3ar4C7ABdk 6uTnXxxb7doBIkIQU3pXfJW9H9tBGByZp+RS8UVH4+z/iC+DpKRQQoJvm+nTGQW0QeXo a+4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rqrCS+Rx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e28si17992564iov.1.2021.08.31.14.30.33; Tue, 31 Aug 2021 14:32:23 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rqrCS+Rx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238727AbhHaSQQ (ORCPT + 99 others); Tue, 31 Aug 2021 14:16:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234154AbhHaSQO (ORCPT ); Tue, 31 Aug 2021 14:16:14 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95856C061575 for ; Tue, 31 Aug 2021 11:15:18 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id m28so682198lfj.6 for ; Tue, 31 Aug 2021 11:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RAusKbpb86Vg8k5m89yF2Mh6kI0kDJIwV1Xq0hJWA0I=; b=rqrCS+RxI/ekdxKFmYlycymJSguGBQKJHXcU43HB1sHn6OPmupvwEmIsd69snQRjIx BQpqSueP5p6VI6OALuuTSnm6vHwDsTCv+Hu2X1k7fjbsGZIpOhVmZzvlD9CpofADPI76 XeXNEKcp2aGhbCBY83R+Xk6JmjABCqNg0FwVNmx1ZKbPTpIXs2ZbKyBhqBr9y+8/zE9Y 7RVUUVdyQUdCEnLIa78RfTPl9/E8y2Nvb3weD82wJvFbQNAaJnO9bL7lsJqdsgi92AHx BTdtMafN57kcKhupMB6k1NjENC0+SrchewVB/jMezkH634zHxLpTuLdAwNgYZRt7FXUr Nyyg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=RAusKbpb86Vg8k5m89yF2Mh6kI0kDJIwV1Xq0hJWA0I=; b=fxypmz0zdlvHFg1tc+4JbtAJ/+8UZnK1IUB1z5Mu2KQUTn0Tzy4+0igmlmt7ajtY22 lWhJ/jtyLPXkrQoQyn3FPQKulI5IVk645wRq8tjTDZdImukksBpNYLG23UILT9RJDUb7 11ooWK+v3A2W6TCVzflNHeLud4RJhsp9klZwx92NAnBkQP60pf7teSvTMD+XVa7GpIrp ntKOcBEm7V4BAVBLF6hVa4zG6PikJnEbUCIcYLTY/Lkbv03WIPf+n/tIZ3QzFwJt2UDm PTAAza10sE/gQnqQDbi++GgdIA5EDzw9xh0ll0ZqHWwtMD7fAFbHrgDggGSx0vATvqgJ T3hA== X-Gm-Message-State: AOAM5322Iufe73R5JRtpzBy+RAeo3kibk4uG0qbO6KmqW2P3MIuo3fYQ k7CEh8YlVWznzlEJOuabu+NwnT1ZyMi8qg== X-Received: by 2002:a05:6512:241:: with SMTP id b1mr22003224lfo.99.1630433716453; Tue, 31 Aug 2021 11:15:16 -0700 (PDT) Received: from kari-VirtualBox.telewell.oy (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id z11sm2270757ljn.114.2021.08.31.11.15.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 11:15:16 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , linux-kernel@vger.kernel.org Subject: [PATCH 1/5] fs/ntfs3: Use kmalloc_array over kmalloc with multiply Date: Tue, 31 Aug 2021 21:15:01 +0300 Message-Id: <20210831181505.1074767-2-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210831181505.1074767-1-kari.argillander@gmail.com> References: <20210831181505.1074767-1-kari.argillander@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we do not use kmalloc_array we get checkpatch warning. It is also little safer if something goes wrong with coding. Signed-off-by: Kari Argillander --- fs/ntfs3/bitmap.c | 2 +- fs/ntfs3/index.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c index 831501555009..aa0b1ea66cd0 100644 --- a/fs/ntfs3/bitmap.c +++ b/fs/ntfs3/bitmap.c @@ -1331,7 +1331,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits) new_last = wbits; if (new_wnd != wnd->nwnd) { - new_free = kmalloc(new_wnd * sizeof(u16), GFP_NOFS); + new_free = kmalloc_array(new_wnd, sizeof(u16), GFP_NOFS); if (!new_free) return -ENOMEM; diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 0daca9adc54c..7676a4a657d5 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -685,7 +685,7 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx, if (end > 0x10000) goto next; - offs = kmalloc(sizeof(u16) * nslots, GFP_NOFS); + offs = kmalloc_array(nslots, sizeof(u16), GFP_NOFS); if (!offs) goto next; @@ -707,7 +707,7 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx, u16 *ptr; int new_slots = ALIGN(2 * nslots, 8); - ptr = kmalloc(sizeof(u16) * new_slots, GFP_NOFS); + ptr = kmalloc_array(new_slots, sizeof(u16), GFP_NOFS); if (ptr) memcpy(ptr, offs, sizeof(u16) * max_idx); kfree(offs); -- 2.25.1