Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2438784pxa; Mon, 24 Aug 2020 14:21:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYYLSGlYeMWYTSZhRS6b3vGf3xtlon8k29FLB4vUx1IzVCEUJUvW+m5CzlfnHvAV782q1y X-Received: by 2002:a17:907:40bf:: with SMTP id nu23mr4016555ejb.47.1598304109317; Mon, 24 Aug 2020 14:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598304109; cv=none; d=google.com; s=arc-20160816; b=TYkfWhTl2XMlQlQ52SlLl8F2MEZN/+Coe6n1AModeQY0Lk2AvnRw4zYrrdT839vopH DCvjkWVLB7kQ4SkQFsTnH9hTmVFddIcRTCRFT0FdCesLhCItKzSz7MqVGjfRRzcrYtxS HrK3RW8YlI2BodnUxYd2wmRGjE5zuO+VZ0Yy4b7rC7KVCPeEgAltis9g+DQzNUjbgNpv IYp/em8wAEuwoJiZ7CLr2QLMHcjDaHGwPeT483WcQj+DqZLQUXyNU3A2oFAAItjRcQDw lkZaQoGSzpfs2aZNuMYCp1Kfez0KB3U0e506wKxq3OC4Bl8FHPb80Zeo3ceNqOD+HuG3 R1dA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=yiV+vzdyB3s6YbQkrMsMF6TiTuCWxljtAH/bA0Yrt6Y=; b=aZGk+Nz7VSPyiG4/YUoxw83oNHEdG7z2wmvqMiYyzPOYeUsbGHSbufnwTLOw4PEMBK Bw6ORDKzzVFfdGUy2qsqXaqWJYYYOI/wAfcGA7tq+YKR001Hawiqx+sN3Fjo1/4I8kE6 Cebi4Ftp+cdJGDShTbpGn+hWus/RcyHMuzAWlArB9/lS/UBtavqf7o4JqU/Baw2t3Vrw B9XrGXoHBjcRcubQ/Mxj1YoBcu0c+HuM38bhgQ1nC1Jw0JNiRWZQvTYu3hZ1zCoFH0t9 Fn9TpJl4pYHBOHE+pjcA8MF7ny8yTZkfiszT5eDs2ny43FcRvda8reMGK4qkm+52dT5U N3Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="gjYH/wpW"; 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 b6si7975836ejb.68.2020.08.24.14.21.25; Mon, 24 Aug 2020 14:21:49 -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="gjYH/wpW"; 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 S1726999AbgHXVSG (ORCPT + 99 others); Mon, 24 Aug 2020 17:18:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgHXVSF (ORCPT ); Mon, 24 Aug 2020 17:18:05 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 241DAC061574 for ; Mon, 24 Aug 2020 14:18:05 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id k20so205332wmi.5 for ; Mon, 24 Aug 2020 14:18:05 -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:mime-version :content-transfer-encoding; bh=yiV+vzdyB3s6YbQkrMsMF6TiTuCWxljtAH/bA0Yrt6Y=; b=gjYH/wpWKMioC0eGcvQc05dxvRGL5hWJNXBr3j0UD3/e7mruv0JSrpM1DONoWc0u7h P4XYm55ZCpKPDShld2EGof5Djhj6y7sZNLJJyh/55du83ljAddZ06BvSVgwyQGGW9ivZ fHgk7x81TPBhOpbp2FJe6ZuIE/u2DPM6838tJ2Q5+ym/tkFif0Bii65EVIufcAZLLK9l HfSbGyA3OaIIz6O8n9EYzcTGE4on0XIPlHcUC4MQ6I4Vq0qf/wpL/9sADhMMDearjHrv o7Y8KrM8neExfMT4D9l+lhiMWPeTqaebNHeas7t8uD5gFevCF5cJ+vufyrPoWX45ifRd 5HbQ== 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:mime-version :content-transfer-encoding; bh=yiV+vzdyB3s6YbQkrMsMF6TiTuCWxljtAH/bA0Yrt6Y=; b=QohGOTMJKVVwwH+noZzYCsfxI3yznfZYxTm4cKJPKLqSqYuc8JLFEJbsgsCStYPOps u4Ug48KjuUrHQvpDJS9yipoEb3iupfvJCvty40m1DR85PgW/q+EYfbLuP4kpnV8uFehx ySQ3p5PE4SlKUt8c4xEhOzVQSgaSmkUKwVilNjWbWxq0it2Sbr0tcU1U4ILBb9Jm4sKH HvdQrfD62XxQu1h2ja0L7nOgi04GKsgmIW2SEM5C1AfgfmeMuo80H6PgrtfpDLYQyG/j y6yRdUfBypOME53STxn+VrpG1AxaQYTAKmr/5PRf7RuyBHGlZbF8TQvVGOb2Wo7HvNnL j8lg== X-Gm-Message-State: AOAM531AmOB1qrsxDl6Jx+bOvYOs5gFr+fk7/nr6dGep3qkwIrHA1Khv BRN92SVLXGv/LJGjAakD8Qa1FNyZvrzupmx6 X-Received: by 2002:a7b:c941:: with SMTP id i1mr1039071wml.73.1598303882684; Mon, 24 Aug 2020 14:18:02 -0700 (PDT) Received: from localhost.localdomain (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id w1sm1479561wmc.18.2020.08.24.14.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2020 14:18:02 -0700 (PDT) From: Alex Dewar To: Bob Copeland , linux-karma-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: Alex Dewar Subject: [PATCH] fs: omfs: use kmemdup() rather than kmalloc+memcpy Date: Mon, 24 Aug 2020 22:17:54 +0100 Message-Id: <20200824211755.597245-1-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Issue identified with Coccinelle. Signed-off-by: Alex Dewar --- fs/omfs/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index b76ec6b88ded..8867cefa79cf 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c @@ -363,12 +363,11 @@ static int omfs_get_imap(struct super_block *sb) bh = sb_bread(sb, block++); if (!bh) goto nomem_free; - *ptr = kmalloc(sb->s_blocksize, GFP_KERNEL); + *ptr = kmemdup(bh->b_data, sb->s_blocksize, GFP_KERNEL); if (!*ptr) { brelse(bh); goto nomem_free; } - memcpy(*ptr, bh->b_data, sb->s_blocksize); if (count < sb->s_blocksize) memset((void *)*ptr + count, 0xff, sb->s_blocksize - count); -- 2.28.0