Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1045331rwi; Thu, 13 Oct 2022 08:23:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Xv45Uk4CqP//Kl7/Y80HRHPh+qSEl4GI8n/0LSp9Xvv9/8hXJLAUuYWILXgwXxC1Notyv X-Received: by 2002:a63:5141:0:b0:43c:e1de:eeab with SMTP id r1-20020a635141000000b0043ce1deeeabmr339181pgl.155.1665674601823; Thu, 13 Oct 2022 08:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665674601; cv=none; d=google.com; s=arc-20160816; b=iB/7gvS7xOKWH0UiAnxgpxdja1oZ9rYu+VuJej0E6I9doOKul+cNH5YR/3WG2QYnHl yoXfktNOPS87epzZX/fns3dpkJivwZYNFbNHr+QbZqqxsIpxC88VT3wdJKwhHM1W/xR8 1ReepGwFrtjepHFFR9HuEUtBLCnUtAoUeCFdLw/CmbaIBcR9MNyel66xLMeW5xDIl7+d Mg3T1Cu3RfU1GF/TtlB2ru33P7+5ZZfUZziIeKaV5jm3hKyiUddfPMJPmGAJ0ffd8xO+ eLgUm8wGgW8cmH6kkgy5OJsmHLkUh5jJcPJoU/Myp0G0PuxI+/DU5Q8qKHFjm3RgCltQ ujyQ== 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:subject:cc:to:from:dkim-signature; bh=3muxJhNWv1hg7XONepRN26NwBDFTg3vZFivnKP3G+hw=; b=lt9MlNEB4NGiwl/4DxT2UMs/bzjQqtTQWAQxs3J69iXI4hufUKqHswlYmS1GWV01rT Km77HVc3jb1osdFdw4ROUUKsIpfn7ixkZ7q6pRpDi8HFGJ7OPLN/cel+FKmnUG8W+j1c /KKimQSulCnpHLkIuDt1eVJLsn47acjCSmuLtGaiAwZ4tYOQ2SC/GORKC3bKOqyBzwJ9 6XWKTxy2ZZiuq22BvsOeCs3/pTqgk21t8Beej71ccGcYbdxCiErgDNdtTylRC3vj0PiR JPGvzwFTogLQbTwSzCuJQgsgpb0w8t1fc83QlHZs2DQAz7sEKtmie135PbGwGjtkMtUe tbmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=F8jmyvQu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020a17090a4dc700b0020aedc078d7si5543062pjl.17.2022.10.13.08.23.07; Thu, 13 Oct 2022 08:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=F8jmyvQu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229791AbiJMPTT (ORCPT + 99 others); Thu, 13 Oct 2022 11:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiJMPTR (ORCPT ); Thu, 13 Oct 2022 11:19:17 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E13B8E09B2; Thu, 13 Oct 2022 08:19:16 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id b5so1822550pgb.6; Thu, 13 Oct 2022 08:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3muxJhNWv1hg7XONepRN26NwBDFTg3vZFivnKP3G+hw=; b=F8jmyvQukbGYiASMQsZRXYBAgV0Gnw2M5nkuujeTetPf3rsaauv9xqFMQYUT5FQ9Ud Kzm0YATZRoKU5vKU9gHFXBPOg/rD6S1vhqv6hIGfuZ5kcBrh5w6IZ1bhSSzfKiOObQNs UMP6K5+2vUvly2DoPvsBAZPTKeTBWcakE49W3hgUx0wDOWxMeujG93vUGfR/2vPwxihL glDzsN22bDxXHParQbQfmUPIxzQ9MwKrKB2doeaqcqTfN1AHs0Ug/bw/R+8scqA8scOF OPyhkNNPjjHd0G2cEEHkktgDhX8FLhEX05vFqHnfXkoPY5X7RhhgLUPRx+nOr1bA73L7 naew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3muxJhNWv1hg7XONepRN26NwBDFTg3vZFivnKP3G+hw=; b=owAIRCTwM6A/D/NIdjOS7XreUu6WAg/mKstc/IVC7VTfG9nCbvsDog6IKYRbdZrEpp SabhYpETPM/GQLuCjcA693pH43KpnZ43w333ZU6zHwn+lgpYJQ2HLNRHPpsBJsBjdE/P D9hx2A6teVfQShYSyrnLa6HRMk/7HBXCBnnPa5OXX48PEoGfkd+0pPIq2U3aCOtqVjiU ykY6+3L06vZo6jlDKZprari0/YD5YmWMj3PsPEkb86I+6atqHdeHxv/RUfv9G3O84/pC M4YkqpNkC8hoi4qnWMiB2+uYAen/Uu2ftN1F0brLehcY2RGwOVVIyFfKy3d2R93PdPgK zaNw== X-Gm-Message-State: ACrzQf3AQUrw9XP4OxlkAup5XVOF1VopfjkkjWaPcO55ftmphEB6soFG 7FLpHkBdyspC20PVjHUfLFg= X-Received: by 2002:a65:5688:0:b0:3c2:1015:988e with SMTP id v8-20020a655688000000b003c21015988emr349335pgs.280.1665674356367; Thu, 13 Oct 2022 08:19:16 -0700 (PDT) Received: from localhost.localdomain (67.230.176.239.16clouds.com. [67.230.176.239]) by smtp.gmail.com with ESMTPSA id j63-20020a625542000000b00562e9f636e0sm2260596pfb.10.2022.10.13.08.19.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Oct 2022 08:19:15 -0700 (PDT) From: Xiaobo Liu To: davem@davemloft.net Cc: edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Xiaobo Liu Subject: [PATCH] net/atm: fix proc_mpc_write 1 byte less calculated Date: Thu, 13 Oct 2022 23:19:01 +0800 Message-Id: <20221013151901.29368-1-cppcoffee@gmail.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122.2) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Then the input contains '\0' or '\n', proc_mpc_write has read them, so the return value needs +1. Signed-off-by: Xiaobo Liu --- net/atm/mpoa_proc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c index 829db9eba..444ceda60 100755 --- a/net/atm/mpoa_proc.c +++ b/net/atm/mpoa_proc.c @@ -224,8 +224,11 @@ static ssize_t proc_mpc_write(struct file *file, const char __user *buff, free_page((unsigned long)page); return -EFAULT; } - if (*p == '\0' || *p == '\n') + + if (*p == '\0' || *p == '\n') { + len += 1 break; + } } *p = '\0'; -- 2.21.0 (Apple Git-122.2)