From patchwork Thu Mar 11 10:34:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhankar Kuranagatti X-Patchwork-Id: 12130887 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 440D6C433DB for ; Thu, 11 Mar 2021 10:35:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED37E64FF3 for ; Thu, 11 Mar 2021 10:35:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232344AbhCKKfM (ORCPT ); Thu, 11 Mar 2021 05:35:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232224AbhCKKez (ORCPT ); Thu, 11 Mar 2021 05:34:55 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9723C061574; Thu, 11 Mar 2021 02:34:55 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id x7so10772541pfi.7; Thu, 11 Mar 2021 02:34:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=LsOaumeF1bmcVfafAU6tzrmF1qroFKtzuGLnEEy+C7c=; b=r7mxmWqZUvPRxN2Tf0nBPPv6ZVCtyKY1eO85F6qwp9uURZvOD3YtUyaeNQqFKIXSM7 7tU1ilpHcXoklZDnJIizla5vIuNpJ3YDlYO5V5PLZ7mcemz0ChUBGhho8fPCeU3+/yWd h+tezmrzydpuAJybKGnG7664qT43RE1urlmN+I/ynMKOVQZE/poYC3GZUB3zu3MBCHjc k5KICnnkd6FEWVTfBk5fPF7T+i60INsUAKKt1UUipwt7NeWOeQ+uZuk6VION2fkWazNO gUBRwIHFFvfTiqgbrMi91Lvbh4zMGM83BhE/6dSuoFoowivegeqn9hbarTW4r9cP297B QcJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=LsOaumeF1bmcVfafAU6tzrmF1qroFKtzuGLnEEy+C7c=; b=rKgUI6VWrl7tfOooHFgxwIswfKAtGyFrrzmOPRpHxYWzEtmRmaCbS1NYODD/tm0WKm ihpxJtwmx4SMvRYij1sJ1r5ReNFtXBUgvnXGyHIWpN9Gf7LjOF7h8vihzW16kjqQKFoH V5mdoNxit7c4cVVpILHmYjS+y1ahXy/vZImHolaB7+wfIEzXKgmtufxqws7fIx0iY59f veBMWtDcz7dhZjwyG57TyEdlJBfxL8NtPFxcEmN1cLdgxpRQ5+L3sZt+xlRs+B+bL596 kKctmIUYsM/lpSIRk3+RWkOc7lSuy161+2drBm8e6hd4HFrCZHyyuGUaJmmWZTMNJ18k w0VA== X-Gm-Message-State: AOAM5318X3/z2uKI3+caJyAVajkDRZU+dquKt2UcgBOsNkpGyK3l3tMD IfM6bNlT17OLZoQiCj/Qxa4= X-Google-Smtp-Source: ABdhPJz3RY6gWzEtcEztwFA61OFqjJ7MBX4+oYMCv7blv4qHRDObAe6Dw5PYquj4XKHmZFguzWVAMw== X-Received: by 2002:a62:928f:0:b029:1ef:2370:2600 with SMTP id o137-20020a62928f0000b02901ef23702600mr7272144pfd.9.1615458895142; Thu, 11 Mar 2021 02:34:55 -0800 (PST) Received: from localhost ([122.179.55.249]) by smtp.gmail.com with ESMTPSA id w17sm2061414pgg.41.2021.03.11.02.34.54 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Mar 2021 02:34:54 -0800 (PST) Date: Thu, 11 Mar 2021 16:04:46 +0530 From: Shubhankar Kuranagatti To: davem@davemloft.net Cc: kuba@kernel.org, edumazet@google.com, willemb@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, mchehab+huawei@kernel.org Subject: [PATCH 1/2] net: core: datagram.c: Fix use of assignment in if condition Message-ID: <20210311103446.5dwjcopeggy7k6gg@kewl-virtual-machine> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20171215 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The assignment inside the if condition has been changed to initialising outside the if condition. Signed-off-by: Shubhankar Kuranagatti Reported-by: kernel test robot --- net/core/datagram.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/net/core/datagram.c b/net/core/datagram.c index 15ab9ffb27fe..7b2204f102b7 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -427,7 +427,8 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset, offset += n; if (n != copy) goto short_copy; - if ((len -= copy) == 0) + len -= copy + if ((len) == 0) return 0; } @@ -439,7 +440,8 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset, WARN_ON(start > offset + len); end = start + skb_frag_size(frag); - if ((copy = end - offset) > 0) { + copy = end - offset + if ((copy) > 0) { struct page *page = skb_frag_page(frag); u8 *vaddr = kmap(page); @@ -452,7 +454,8 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset, offset += n; if (n != copy) goto short_copy; - if (!(len -= copy)) + len -= copy + if (!(len)) return 0; } start = end; @@ -464,13 +467,15 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset, WARN_ON(start > offset + len); end = start + frag_iter->len; - if ((copy = end - offset) > 0) { + copy = end - offset; + if ((copy) > 0) { if (copy > len) copy = len; if (__skb_datagram_iter(frag_iter, offset - start, to, copy, fault_short, cb, data)) goto fault; - if ((len -= copy) == 0) + len -= copy + if ((len) == 0) return 0; offset += copy; } @@ -558,7 +563,8 @@ int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset, copy = len; if (copy_from_iter(skb->data + offset, copy, from) != copy) goto fault; - if ((len -= copy) == 0) + len -= copy; + if ((len) == 0) return 0; offset += copy; } @@ -571,7 +577,8 @@ int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset, WARN_ON(start > offset + len); end = start + skb_frag_size(frag); - if ((copy = end - offset) > 0) { + copy = end - offset; + if ((copy) > 0) { size_t copied; if (copy > len) @@ -581,8 +588,8 @@ int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset, copy, from); if (copied != copy) goto fault; - - if (!(len -= copy)) + len -= copy + if (!(len)) return 0; offset += copy; } @@ -595,14 +602,16 @@ int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset, WARN_ON(start > offset + len); end = start + frag_iter->len; - if ((copy = end - offset) > 0) { + copy = end - offset; + if ((copy) > 0) { if (copy > len) copy = len; if (skb_copy_datagram_from_iter(frag_iter, offset - start, from, copy)) goto fault; - if ((len -= copy) == 0) + len -= copy; + if ((len) == 0) return 0; offset += copy; } From patchwork Thu Mar 11 10:39:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhankar Kuranagatti X-Patchwork-Id: 12130899 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E0B2C433DB for ; Thu, 11 Mar 2021 10:40:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E202A64F94 for ; Thu, 11 Mar 2021 10:40:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232430AbhCKKkB (ORCPT ); Thu, 11 Mar 2021 05:40:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232428AbhCKKjn (ORCPT ); Thu, 11 Mar 2021 05:39:43 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85C04C061574; Thu, 11 Mar 2021 02:39:43 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id o10so13423488pgg.4; Thu, 11 Mar 2021 02:39:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=ksz1ClkKIObXGUsnxvYXkjPZ5AxFir+5GzKwQdaVeZ4=; b=glGAYCb2J+aohcnZfHsxGcq9gmaxxzKkFCmlrMc6B1lphAB8nA6a2Nsz9kFn6IZZKH jsh/Uh1Mp+v0dqYDvDSoJqmVDy4wNOotAuhIDtUzqYHQenVuaDfJveQCI9K3h+IOOsjz rofSB1BhuEJ551ut36Tp0UfH/p+w8zdhRZDMVouaO9oq36v0p91r6C9kG49EPYj52lnd J0kGks9mqU7PqqddC0SQpdfVc9FDLTESZhOFnO1T9GYj3vT0eIDPuCz+eFNkZIRbUiN/ tvG2lIw+NYt3ZxEaQqI2sxw2I8EWedMy98aw4HqwxP8l0CMylqLMoQYb7XJUSscZSQdL kszw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=ksz1ClkKIObXGUsnxvYXkjPZ5AxFir+5GzKwQdaVeZ4=; b=gaky0EnwbhUzxp30rVZEJsBVri2ATZiONkdm+01ipcsdWG5etlgKswYkqb0yyVTJti +55An4+R+Wj6ilQzpGMXm62X1aADyPcA854ex6CbCU82HSX61EzJirTkj1JPLSsTwpY7 cs7bIrXyTfjSBEo00ZGqb8hA9x81cfmf3k3MEqZ3LjVx9jAJWpH/Nl7HlKJWVeIJncRz fIhUZfxG2hDZc7I6qCdgUdLPekpqMa2gHbfTA1JxIy/w1VtKIUL2BUXkH3eNXWvL9uli BkEBK425AXAHpn9h5KPT8ylJheeVXd0z9gKsIDsb0Z6QdKfz+xDPlnv8VjAXAPIIkkpc SgyA== X-Gm-Message-State: AOAM532SfZKrdFGJnc707GwHdZiU3yq/7+9RYkn2SSy3YtprpGv1kgC2 iQJdJFO6x9CaWXEG8IHfYNA= X-Google-Smtp-Source: ABdhPJySrGWHgC0rmPQWoAcau37pT3ZtM+/0dd4hayOxBC9cK9LxRGaHAfwGzdxctWOn89FetRYNMQ== X-Received: by 2002:a62:7bc4:0:b029:1f1:58ea:4010 with SMTP id w187-20020a627bc40000b02901f158ea4010mr7224368pfc.70.1615459183097; Thu, 11 Mar 2021 02:39:43 -0800 (PST) Received: from localhost ([122.179.55.249]) by smtp.gmail.com with ESMTPSA id z3sm2047725pff.40.2021.03.11.02.39.42 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Mar 2021 02:39:42 -0800 (PST) Date: Thu, 11 Mar 2021 16:09:40 +0530 From: Shubhankar Kuranagatti To: davem@davemloft.net Cc: kuba@kernel.org, edumazet@google.com, willemb@google.com, mchehab+huawei@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] net: core: datagram.c: Fix usage of space before tab Message-ID: <20210311103940.2szjikrdghhosswz@kewl-virtual-machine> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20171215 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Removed an extra space before the tab key. Signed-off-by: Shubhankar Kuranagatti --- net/core/datagram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/datagram.c b/net/core/datagram.c index 7b2204f102b7..be0caaec9add 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -790,7 +790,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb, EXPORT_SYMBOL(skb_copy_and_csum_datagram_msg); /** - * datagram_poll - generic datagram poll + * datagram_poll - generic datagram poll * @file: file struct * @sock: socket * @wait: poll table