Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3960516pxk; Tue, 22 Sep 2020 07:07:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGuvNKfjSJ9/6AhOjhl+l2xttXvsCZnDhJzrWrXWeIrJaU/DhaJBPWQXLzaI2oeoWe4ZzT X-Received: by 2002:a05:6402:18d:: with SMTP id r13mr3944015edv.267.1600783662185; Tue, 22 Sep 2020 07:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600783662; cv=none; d=google.com; s=arc-20160816; b=kKCGP5d00iS1gPcN/6It2qnQglbP9UHjI3sGRIArSqEhEz5kJ9WzB2tB2bZV3Dk+bD l5s5S80euiFt59l1y4IWr4B52p7z6rAOvrkD4yehfTtaWmxNO6uo6jtIsLxFR3mCxepi kpOqSeq6tdgSVBj6ghB20pd2MFQ0locsOuCGghqTIhr2NB0xGlfxwYxup8Uch7KwwGxL wzOLjUCb8VZFKOn3lpF/3p2oFszFTT1pFykV2SBLvw7eWtPv+NOXunfIsoD+7s7keVm3 VHL/un1KyyFe3QltkF+yt5yc3P1KD/fdXoXV1r+7z/glx+mi+PPJRR5+LVZ4JQlcZWr1 j24w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:reply-to:in-reply-to:references:mime-version :dkim-signature; bh=ggv8VuLQMJBV80+GzZgkXohh+I/h8XJJBp5IUz+/fvo=; b=yQpyLyeKW+YfZXvnzTQN9grNFqT9/u9xp5lsBIxNCNKR+gHb31g8xltZKXvO4Zq9/l NKvCX0UDdMAkcVZhomHZswQ0JRpyYzlBZMFrn0fqJkgptE/8uCzV2KhqdEG/RjKoImL6 AyghXaRZT4Jw3md92KrJjZ9e3WmGb66sF20ztFkKB4zRfMEiGdtT4F/xVc9ReRpKjpqd 2U8RI/gF1n72+4QwNvohYARcPCD2wdjAOK6kVzy6Pds6Ho291ff5YypnwX7ImftgfI4j TF9hKbr4e2kF+WFbjut8lceToDD7oQS8Os03w+O699cF2G40DIxKub+3IHP+WJCVmNvd nBxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p4MQ96FS; 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 d20si9846505edq.603.2020.09.22.07.07.18; Tue, 22 Sep 2020 07:07:42 -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=p4MQ96FS; 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 S1726645AbgIVOGL (ORCPT + 99 others); Tue, 22 Sep 2020 10:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726473AbgIVOGL (ORCPT ); Tue, 22 Sep 2020 10:06:11 -0400 Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A8D7C061755; Tue, 22 Sep 2020 07:06:11 -0700 (PDT) Received: by mail-qv1-xf41.google.com with SMTP id f11so9590526qvw.3; Tue, 22 Sep 2020 07:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=ggv8VuLQMJBV80+GzZgkXohh+I/h8XJJBp5IUz+/fvo=; b=p4MQ96FSgJ+qhEE9FsMlf9iPP1EKo3i6eXh8PekF+Z8ZJtAvSWWKJomaFDWkJIVBxx g1UdB6PKqDQjHPJ5Y2QI1uLWZmpj03Ie1OmKV6QETtOXAKTF0Bx89UVOwOqZehk8WZ1C gnrOSydC3qqJkUpEYgZxurxgz9TtKFDfYav3YuPgELvHyiCIavz9slbW3V8eaogcoLoV zbS+W0qZ3+GyizlbrtqXJI8ecYXiK3ucVB/XoHit7s0vE2VU9vTf1WmkeS4pWw4M7L6L g5APi97Ksne3ulKMs47b1+Xde0+Pcp1wJ+getd21S4iypZo63u4s0QJBOvJIymfdghak otXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=ggv8VuLQMJBV80+GzZgkXohh+I/h8XJJBp5IUz+/fvo=; b=rFWpffKZzO3Qaw2Pw/VJIzigkC221g/Q11WpT9PHK+7nAIc1dBEjfxAchvuvEHcyZs QvYWMPEcc8nYRRSpj9aGVxIu0fdT+0+gtx6BgIyr/tjFtwazG8n8mbrccxk/EVv/XtPw Mb5SAWgmtVbTZ3l/10aPzdFkvioRZG887DT+4Yj4mnf4eMp1/JmwoDwWAS0JQxsj5u7x 5qdOS1y1SLnO2HHb3nDnwe3p7l78GyTFFa/wAvziEsTvOLXw1ZXzFGcGyl3pA0xgTy31 YnSgbFPhnvFFovRhzoqpneSuaAd0Joo01Y3vnyqIRA++tfHS4GTK86joGojsI+mJpPr0 btJw== X-Gm-Message-State: AOAM530tTjBOO6jltFiLV3wXybWqR6G2JLyKNMM2u8suQ2ZYxYOxWens keax5LoqWri9zxiZbxVOFOFV7/wQHGCjoyMNXCOe7mR2 X-Received: by 2002:a0c:e152:: with SMTP id c18mr5893009qvl.41.1600783570742; Tue, 22 Sep 2020 07:06:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: fdmanana@gmail.com From: Filipe Manana Date: Tue, 22 Sep 2020 15:05:59 +0100 Message-ID: Subject: Re: [PATCH] btrfs: fix memdup.cocci warnings To: Julia Lawall Cc: Filipe Manana , Chris Mason , Josef Bacik , David Sterba , linux-btrfs , Linux Kernel Mailing List , kbuild-all@lists.01.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 22, 2020 at 11:29 AM Julia Lawall wrote= : > > From: kernel test robot > > fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup > > Use kmemdup rather than duplicating its implementation > > Generated by: scripts/coccinelle/api/memdup.cocci > > Fixes: 28314eb24e6c ("btrfs: send, recompute reference path after orphani= zation of a directory") > Signed-off-by: kernel test robot > Signed-off-by: Julia Lawall Since this is not in Linus' tree yet, it can be folded in the original patc= h. David, can you do that when you pick it? Btw, isn't the Fixes tag meant only for bug fixes? This is a pure cleanup afaics. Thanks. > --- > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux.gi= t misc-next > head: 28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06 > commit: 28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06 [2/2] btrfs: send, recom= pute reference path after orphanization of a directory > :::::: branch date: 17 hours ago > :::::: commit date: 17 hours ago > > > send.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > --- a/fs/btrfs/send.c > +++ b/fs/btrfs/send.c > @@ -3851,10 +3851,9 @@ static int refresh_ref_path(struct send_ > char *name; > int ret; > > - name =3D kmalloc(ref->name_len, GFP_KERNEL); > + name =3D kmemdup(ref->name, ref->name_len, GFP_KERNEL); > if (!name) > return -ENOMEM; > - memcpy(name, ref->name, ref->name_len); > > fs_path_reset(ref->full_path); > ret =3D get_cur_path(sctx, ref->dir, ref->dir_gen, ref->full_path= ); --=20 Filipe David Manana, =E2=80=9CWhether you think you can, or you think you can't =E2=80=94 you're= right.=E2=80=9D