From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F784C433EF for ; Tue, 28 Sep 2021 13:37:14 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F52F60FF2 for ; Tue, 28 Sep 2021 13:37:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1F52F60FF2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 39C0283372; Tue, 28 Sep 2021 15:36:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="G2ANtZUs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B7790831A0; Tue, 28 Sep 2021 15:35:27 +0200 (CEST) Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 91D1B83398 for ; Tue, 28 Sep 2021 15:33:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rfried.dev@gmail.com Received: by mail-oi1-x22f.google.com with SMTP id q16so2271643oiw.10 for ; Tue, 28 Sep 2021 06:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wd8bNJt+p1lrk81H6e/hU1UviXCRnURqxEPn9XsKnuI=; b=G2ANtZUsawNJ1xAIRlp4v05jKiIFnh6GJOrt8fydoYa7WCrcFbPwql1RjPIAoR9diQ hLyyqlnhH7OmwUF4rp6IP8OaWFAnPjsT7JDwLZ6YKLFJNjf0K8SclDtZEO/xoTrFka3F ku5ErFKEnIsuMrCQpVqIcp75oEsVSAB1GlmxR7/MED4P8KaVk1ATaeUJH30uuqqTbHof J5HGDtEfM5syUHIhTXRsM4982Ly/co9Q5xdxjH0ytpDX+tMPGEPOm6d9FA2L5N+DBY/g dNQNisy9h/B+qjF0/FS6/ygPefF/rTik967oJz2w1/LggfTV9mB249W0FO9U3mpRG3T2 klog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wd8bNJt+p1lrk81H6e/hU1UviXCRnURqxEPn9XsKnuI=; b=UTtd3Bpl9cyL4nurOM/li9LsvBJbCkd/C5QfA+CGT/rPNtx2oxQWNnwZ2LoGfNlDKw FbzGB06RydWdZXCNw79pUQ3r4fb1zf5l7NAy55Dqhr0b1PX2Kg0lIy16AQfif3iiZ4++ yHF9FNMgpDWWvbPgcxR2lOIzJeJMAQaJJdZQbcujUDCXT1wTO8+nHAx7W1YOHTrLki6J 2cjzPHqFmrivXtm/VemvfrGZTOhQ3SkdPUUY5PyKz8vY+pceBMyKqcP/jwbqpqb3/16l T9xWphwPjZoBxdbRof2h3Q1GhhCqCJHDFKUrwD1/10Zh8k8sFozrPnDzYNjH9gCmossp EbYw== X-Gm-Message-State: AOAM533KjC9wuDPuKnK89Pfd7EhDkqjvOkuYUKaZIawwQoEJl1ATCjnK knCfWN0wTaBbtuskOeYSNoacUsTeqHG9/TgGb+M= X-Google-Smtp-Source: ABdhPJwnWL7y/dPO507pKIHUrinzctbvJn2//Sbr+MoBmIaamCBwCI+2FJeTDn5PTzMo/g1Jor2ouZdfwAmi5VZw7R8= X-Received: by 2002:a54:4f1d:: with SMTP id e29mr3619156oiy.179.1632836035341; Tue, 28 Sep 2021 06:33:55 -0700 (PDT) MIME-Version: 1.0 References: <20210927112205.301876-1-vladimir.oltean@nxp.com> <20210927112205.301876-21-vladimir.oltean@nxp.com> In-Reply-To: <20210927112205.301876-21-vladimir.oltean@nxp.com> From: Ramon Fried Date: Tue, 28 Sep 2021 16:33:44 +0300 Message-ID: Subject: Re: [PATCH 20/25] net: mdio-uclass: rewrite dm_mdio_post_probe using strlcpy To: Vladimir Oltean Cc: U-Boot Mailing List , Joe Hershberger Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Mon, Sep 27, 2021 at 2:22 PM Vladimir Oltean wrote: > > dm_mdio_post_probe used to be vulnerable after truncation, but has been > patched by commit 398e7512d8d7 ("net: Fix Covarity Defect 244093"). > Nonetheless, we can use strlcpy like the rest of the code base now, > which yields the same result. > > Signed-off-by: Vladimir Oltean > --- > net/mdio-uclass.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c > index 1b687765b8ca..e74e34f78f9c 100644 > --- a/net/mdio-uclass.c > +++ b/net/mdio-uclass.c > @@ -101,7 +101,7 @@ static int dm_mdio_post_probe(struct udevice *dev) > pdata->mii_bus->write = mdio_write; > pdata->mii_bus->reset = mdio_reset; > pdata->mii_bus->priv = dev; > - strncpy(pdata->mii_bus->name, dev->name, MDIO_NAME_LEN - 1); > + strlcpy(pdata->mii_bus->name, dev->name, MDIO_NAME_LEN); > > return mdio_register(pdata->mii_bus); > } > -- > 2.25.1 > Reviewed-by: Ramon Fried