Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp264056pxb; Fri, 8 Jan 2021 04:31:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBdf1A8WRfz4z3VgJB5QVY1KS+Q60Jz6QJ+BQHH1CAfxDyJoVp7m8wdlH85e1YaKfD4k1/ X-Received: by 2002:a17:907:4243:: with SMTP id np3mr2469904ejb.212.1610109067048; Fri, 08 Jan 2021 04:31:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610109067; cv=none; d=google.com; s=arc-20160816; b=svDHIOSr1apupM3s02ZNAn4ziSHLJmmqMLw+pM8VyXaXWQTFWW4MPfe1g82jd24i5+ RIe18w/pjAAV8o+z6WcgOxoRJmF2zNy70RuifUZVZ7iIKGjjvSN97pMuVlgf1vxSEJgf oAo4Aqg8TyeuXXOH5IKIsvHqKtx5+mv5/w91CuR5BtfdTmm46mw5q0x0tWudbl7qZIkT gSAvJn5aDYPFJ4eI0n2U8udqFMXy+xn+JHtHCXYnI0kRDs4h6Sn6LTDrPtFRkDgX02Bq U1goQSI+AsUevKwA5cqy8bKZaFItB1jGuMqog5sSMCMBVZziXz0OfjKacMlLdC4EakZZ hADw== 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 :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :from; bh=VtLnzroK+2amKxWDyTUZnKjWt0Rq7/Q1OIGNNizkWS0=; b=QCViI4odEMQ7PJW1n5d3ygGPT548yaG+UjUqaM41C440i9j9lR7yAkEK3Hc8+jyI3h OYz2zZS9rPJqjsrH3B+L9w6GBEkvHzX0HG4wuGIR1DSt6JLakmcKIY9yXIgukeDb5bmt hfn5ysXlC/TG0u3uVbvWD7wn22nt7KnFWGfySVkSSN0KszhmHiFlxC+vIOaH09NaFRhV sjIOSDQ0/WpKe9f2LUyXBP/03EhZqcIq5g+jh22lUskqtWqFHNJCqot6y9UUn2Bh1kXA 2dQiijA/CwDuKtlMjqrvXDqrFgbja9H2aGGE+ifkKMU//MsP8u0TfJkztpuV0yNZ2jlm wzZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=i9LXKNH4; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e26si3919109edv.40.2021.01.08.04.30.42; Fri, 08 Jan 2021 04:31:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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=@toke.dk header.s=20161023 header.b=i9LXKNH4; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727130AbhAHM2m (ORCPT + 99 others); Fri, 8 Jan 2021 07:28:42 -0500 Received: from mail.toke.dk ([45.145.95.4]:59723 "EHLO mail.toke.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725926AbhAHM2m (ORCPT ); Fri, 8 Jan 2021 07:28:42 -0500 From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1610108850; bh=XrbMDAa3p/Vtl/GFCNGFI/BX1TzGSrmhTacLKUkj8Ak=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=i9LXKNH473wIxrKg1IhZ9ZPexv3Nv6TlUnndvsCjjuV4nCZX0KwNChYYf7dGbbUiw D+g/KG5/21hxtipROXxaN/XxDuEWskg9ogBeM0Qzj6jCcZ975tf3oxRO3Xo7qsvTix UnePKUi6LeV9+ANJQ5EOusFi2XxwHLYC6tt7cx0j5mm1jmyTKolii7VQnY3/leQ6sn dTpK6yRBCesg7lsFLjRHSJO4hYWjdE9LdWZ8udmTsEbqB14skvtBhA+c7hfqbKrWwB tBWuHv+aQccSHH2LQyY4bomdEQ+8+NEzzy6NhYj5DnlvQaZRIl+eRRI8EMLRKtEHD3 hMXtcEoFQ0gZg== To: Shayne Chen , linux-wireless Cc: Johannes Berg , Felix Fietkau , Lorenzo Bianconi , Ryder Lee , linux-mediatek , Shayne Chen , Sujuan Chen Subject: Re: [PATCH] mac80211: fix incorrect strlen of .write in debugfs In-Reply-To: <20210108105643.10834-1-shayne.chen@mediatek.com> References: <20210108105643.10834-1-shayne.chen@mediatek.com> Date: Fri, 08 Jan 2021 13:27:30 +0100 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <8735zbipfx.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Shayne Chen writes: > This fixes strlen mismatch problems happening in some .write callbacks > of debugfs. > > When trying to configure airtime_flags in debugfs, an error appeared: > # echo 0 > /sys/kernel/debug/ieee80211/phy0/airtime_flags > ash: write error: Invalid argument > > The error is returned from kstrtou16() since a wrong length makes it > miss the real end of input string. To fix this, use count as the string > length, and set proper end of string for a char buffer. > > The debug print is shown - airtime_flags_write: count =3D 2, len =3D 8, > where the actual length is 2, but "len =3D strlen(buf)" gets 8. > > Also cleanup the other similar cases for the sake of consistency. > > Signed-off-by: Sujuan Chen > Signed-off-by: Ryder Lee > Signed-off-by: Shayne Chen Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen