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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD833C433F5 for ; Thu, 12 May 2022 16:16:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356349AbiELQQT (ORCPT ); Thu, 12 May 2022 12:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356358AbiELQQF (ORCPT ); Thu, 12 May 2022 12:16:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 254EA2CE0C; Thu, 12 May 2022 09:16:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E4662B8289C; Thu, 12 May 2022 16:16:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDA5EC385B8; Thu, 12 May 2022 16:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652372160; bh=PzJTwJvRoh0iLBbASZwmkvmzuwaO0XJWC6WuChXQ7eQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SEqXrSVMAGB+CXf9ay6pa/cZNdKkM6H00owsDhRj8cRsLP/x2qHBm6GCt8+JurPio Tb+4ftqBftUeFBVGXma6w/6JqBZvZYrFB1dJFo4TMYAsLEYCUEOcw7e++arNgN7HfL Zt02rqIO5ccqXP9lH4ciGPwqrlNsLbpOWfTIy4FpomvBlJEzbIo9ABVLgv6HHwTAc6 NaBZZlbzWgTGAKe3t6ayzVBIAQ3qCK1l7buFKVkz9cQtqQosveStoC93/jAp+BW/mY dzA5CMrWC1aNAlyq2M13L1xB392AyCEL1prCW6g/Nqa+86ren3e7HqtnTOIEjcBALG 5otxsTHh2yQ/w== Date: Thu, 12 May 2022 09:15:58 -0700 From: Jakub Kicinski To: menglong8.dong@gmail.com Cc: nhorman@tuxdriver.com, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, imagedong@tencent.com, kafai@fb.com, talalahmad@google.com, keescook@chromium.org, asml.silence@gmail.com, willemb@google.com, vasily.averin@linux.dev, ilias.apalodimas@linaro.org, luiz.von.dentz@intel.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net-next v2 2/4] net: skb: check the boundrary of drop reason in kfree_skb_reason() Message-ID: <20220512091558.350899ff@kernel.org> In-Reply-To: <20220512123313.218063-3-imagedong@tencent.com> References: <20220512123313.218063-1-imagedong@tencent.com> <20220512123313.218063-3-imagedong@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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?