Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2249073pxm; Fri, 4 Mar 2022 12:18:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxMDXVWIIUrwFaubm4RvboPO1j/qMur7JvO7A7b07UYZYlwMkjiggHSCkDUgIuqxw15qcJ X-Received: by 2002:a05:6a00:b90:b0:4f6:b88d:ec96 with SMTP id g16-20020a056a000b9000b004f6b88dec96mr175094pfj.12.1646425084294; Fri, 04 Mar 2022 12:18:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646425084; cv=none; d=google.com; s=arc-20160816; b=Q5RHIozZt5waJaYskktgT+t0qKh9ZAmxswT629MyaZXKjjCpzkYh8sPax6zImgVmna lx1oJc8C4C03cczrnwcM20utA0kgSAS2zTk39U1p8tktdeLKQLBRedkDhOcwbPtSd246 sxZ2wDxnOtklVJ27uNiqokH2ph9VIGJ0r6S9uKFeJm9IYW7/gdK8mIeJMOSj0LJG0s0I 5Bv/+YMMgCslijtpFYGpQdb8twOSYsVF15ewvViQ4wFbDRE91wfMqJr/4eWK7JhMS+Cq 3W8so0tV1ArCS5AuD0JzDT20UEt09d6bzGp+FX5Ycn2Bk+e+dFgXmAwWg5RARGW66y/I JW3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ob7Mkf3eqtmT+BWu12pZ85qVfu2ZGDiN4QGgeAdW7ok=; b=UmCUMUvR/qeXnZ6ShWi3bkqyEXyyGNDhQSj9ITgbHHRMUJOeIOHMmaIcgzTK0GdK3w +GZL/uyUFsUCMhM+fpJIaEym1oz8El4dBnDPXfFukSyllKzfQQg3YpapuHJjgZeC1zzP uxfKtk+OgCRrbL13PRiprVxFkLep54vPbRQOgoY9XRWPReM4jzxYTKVYJOsAqVwtPe9W 4hucnMLwXLV1CiRky7OTGsqspMgax/n3mSK4RzmeF5DUgrBVS+Iy1M8MEwt+K1/mFv38 Ix5VNrL4f9+2uAUXcM1qbt6Zq4ImUPCknVPah6GZMKA3Aag9Qn1KiQvRxtlHfGErT21c RgVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ntaTRqII; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l7-20020a635707000000b003759f06bf6bsi5251143pgb.809.2022.03.04.12.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 12:18:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ntaTRqII; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 74FBE2D7475; Fri, 4 Mar 2022 11:29:52 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241771AbiCDSic (ORCPT + 99 others); Fri, 4 Mar 2022 13:38:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241545AbiCDSia (ORCPT ); Fri, 4 Mar 2022 13:38:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4732A5370B; Fri, 4 Mar 2022 10:37:42 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id D874D616DF; Fri, 4 Mar 2022 18:37:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D0BCC340E9; Fri, 4 Mar 2022 18:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646419061; bh=WaRcga7Eg/bbAL2UzogdnEJpm6/3LfKVskH9KOpXwQw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ntaTRqIIyqa8VAH0x41eMpPd2xEmMIdKOToN+x5AtVbQY5+PDo+j2r29hMcHwoLJ4 k2igqVIr0Al/qjlSreiPpDezZnR8qr0oDtKXTu7Fn5BO5kq/koFqbJbOh4K++sibzy O4g6HF1BDA0qsElkAK9FgadPPVQwHlHAA8IBujgo= Date: Fri, 4 Mar 2022 19:37:33 +0100 From: Greg KH To: Benjamin Tissoires Cc: Jiri Kosina , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , Dave Marchevsky , Joe Stringer , Tero Kristo , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH bpf-next v2 12/28] bpf/hid: add hid_{get|set}_data helpers Message-ID: References: <20220304172852.274126-1-benjamin.tissoires@redhat.com> <20220304172852.274126-13-benjamin.tissoires@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220304172852.274126-13-benjamin.tissoires@redhat.com> X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, URIBL_RED autolearn=unavailable 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 Fri, Mar 04, 2022 at 06:28:36PM +0100, Benjamin Tissoires wrote: > When we process an incoming HID report, it is common to have to account > for fields that are not aligned in the report. HID is using 2 helpers > hid_field_extract() and implement() to pick up any data at any offset > within the report. > > Export those 2 helpers in BPF programs so users can also rely on them. > The second net worth advantage of those helpers is that now we can > fetch data anywhere in the report without knowing at compile time the > location of it. The boundary checks are done in hid-bpf.c, to prevent > a memory leak. > > Signed-off-by: Benjamin Tissoires Reviewed-by: Greg Kroah-Hartman