Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1244693iob; Thu, 12 May 2022 14:44:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh6ATEPyPI5+0QTE2I3X5c0AgwPZjyoS7sj82P7f5W0J13ZnzXGDxXlNoEo5aRr54l6gVd X-Received: by 2002:a17:907:7f8a:b0:6f4:d25a:7fb6 with SMTP id qk10-20020a1709077f8a00b006f4d25a7fb6mr1720588ejc.586.1652391858448; Thu, 12 May 2022 14:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652391858; cv=none; d=google.com; s=arc-20160816; b=XLvnlnG4784tus9N1uqgLcbkGSFePAgAnxV7yMeHqOq4uF2bG1qbG2l2FO7So6tFB8 S3Z00kFojHyUsHS+meT69wOmDI+c7lWPf/0lB7Bw0Dd1xfgtGWaINkUNWg053AHKnJgI jbsW6h/fQdioIS/caO4yoz63EwnMEpmr1HK1hIjYtOWnTx+ktn5NmFNzcaZ7pNEYXrmX v68zb9z9Vr17m2ttCwQWbcS6uh+UIOKQdbI84O5XZLwmsEEC698itVG1UP5WCzfzhq5S AkvM5jVLHoZmnzlQXPAmHPeQaNTe09sufqvCrs1qIXMaqFOyzN2pm1OTeawNvpoq9bqK oXJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=w7wTiXZa6qZi+HuOeJOMfyweTiYDquNYmgNLPQKJ4no=; b=bVV1hSOtZZFYJ0NUIIqk/ACrfUVIveVuKE6kENG/+0hifggHVKgEq8IrrBDHA2IkSd AEWzN6YpSES6fZuA6X9+DP2k83i/O2hWOPtixndykzdHHgFPlzRp07PLhL5VgcxHjoft bUYnRZGW9xCgL+kA4TndOHSNSxz0lDabOl13cIeXj4qyQppxKs1aoRi3HyJzdaRPLPBs pCP+sNKYw+CmlFvFw5mG+TSArMtcPMMjLnIZ6YOXKxqKvnEym+XqsGMM9XtJ2+L+fN5P 1saEBay2bZVS+pJqa+1qdj9JIpKLfufJvzOSz/Yp4VeNM4NIHQwQvC6j/FqmqWvLQffU 6CPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=GEVkY8kL; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa28-20020a1709076d1c00b006f3b5469ea0si511929ejc.96.2022.05.12.14.43.52; Thu, 12 May 2022 14:44:18 -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=@google.com header.s=20210112 header.b=GEVkY8kL; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356379AbiELQRD (ORCPT + 99 others); Thu, 12 May 2022 12:17:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356360AbiELQQv (ORCPT ); Thu, 12 May 2022 12:16:51 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FB61689B0 for ; Thu, 12 May 2022 09:16:51 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id i38so10625823ybj.13 for ; Thu, 12 May 2022 09:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=w7wTiXZa6qZi+HuOeJOMfyweTiYDquNYmgNLPQKJ4no=; b=GEVkY8kLTlT3Zy8fuo/W1ScuRvPz67G/Ak9nk9vrqHlwVlQdbmYVORGQ0loita8kIW itcV+avbnkCZGJ++sfsBPqncwNp+TByA22jLgIe+QDW2nNo8e2kjxpwARrUecL95MFwx P8rFf44fate+74wX19swxBtY9pkFwIygNInH5B/kYFpeML071eBRea9GYDUm0dnUOGpd mE8nYc/etwptKy04i9rivVhNdkB7CeRR78jmTlQD+Li+JpUsIbbn/tB+uIUExhB/9V7A IM+NsA0rCEy/a9/Lx1Ryw3rs8i2Hy74RKxdoapJstrbZENaWdy6APZiT3KT1p9ueqiUK QBLA== 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=w7wTiXZa6qZi+HuOeJOMfyweTiYDquNYmgNLPQKJ4no=; b=KqZokWO/xufnR45Q5L4C1sLgmbqU906M/fYAO171+2H/p3QX1kJwOFgZEw00Pk22LI re/XYH3HU1Z+WxVe2zTNv9tscbhWwylh5FKQgd/JIx57nr/MlKY3HisXze/Qvr+yalO4 4XIyXcP2Ubs9UI2oY7IpywO48bre0lcepxRuquOW/6pHczW264bYxCGrv4h2kaQC8UyR mBJ+6Z39+JJyyd4tyDrbdNQCTEwMRBvwUH/iSrnxDvOmnzdyhf8puWhflQV/wIB052SW 7tfDIpBHK4V7Sm+WnNuqNTfJLUIMlNdp8LaDmuMoSSbJ8KUd/MIDGPjeqUuvS2h6vZVt RO8g== X-Gm-Message-State: AOAM532UseXH//z0jHX37AEOWp1aL7UKzoWe/VqZ0JJsJ10N6DX1vLw3 e+lnCqxnluEzGuU8CjA+kZO5+08R0IjHEaf64/QJKA== X-Received: by 2002:a25:230a:0:b0:64b:49c:c67c with SMTP id j10-20020a25230a000000b0064b049cc67cmr604298ybj.598.1652372210156; Thu, 12 May 2022 09:16:50 -0700 (PDT) MIME-Version: 1.0 References: <20220512123313.218063-1-imagedong@tencent.com> <20220512123313.218063-3-imagedong@tencent.com> <20220512091558.350899ff@kernel.org> In-Reply-To: <20220512091558.350899ff@kernel.org> From: Eric Dumazet Date: Thu, 12 May 2022 09:16:38 -0700 Message-ID: Subject: Re: [PATCH net-next v2 2/4] net: skb: check the boundrary of drop reason in kfree_skb_reason() To: Jakub Kicinski Cc: Menglong Dong , Neil Horman , David Miller , Paolo Abeni , Hideaki YOSHIFUJI , David Ahern , Menglong Dong , Martin KaFai Lau , Talal Ahmad , Kees Cook , Pavel Begunkov , Willem de Bruijn , Vasily Averin , Ilias Apalodimas , Luiz Augusto von Dentz , LKML , netdev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Thu, May 12, 2022 at 9:16 AM Jakub Kicinski wrote: > > On Thu, 12 May 2022 20:33:11 +0800 menglong8.dong@gmail.com wrote: > > + if (unlikely(reason <= 0 || reason >= SKB_DROP_REASON_MAX)) { > > + DEBUG_NET_WARN_ON_ONCE(1); > > + reason = SKB_DROP_REASON_NOT_SPECIFIED; > > + } > > With drop_monitor fixes sending an invalid reason to the tracepoint > should be a minor bug, right? > > Can we just have a: > > DEBUG_NET_WARN_ON_ONCE(reason <= 0 || reason >= SKB_DROP_REASON_MAX); > > and avoid having this branch on non-debug builds? Exactly what I was going to say.