Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26141550rwd; Mon, 3 Jul 2023 06:04:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlGTY9pIfuQ4EqR1Mr8ERgu/DCznaK9MKxkUQkacO7p1CvtIaGIo+qRpfQ9KFsVWFpNKUUfu X-Received: by 2002:a05:6e02:549:b0:345:baef:842b with SMTP id i9-20020a056e02054900b00345baef842bmr9347911ils.25.1688389474680; Mon, 03 Jul 2023 06:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688389474; cv=none; d=google.com; s=arc-20160816; b=mOIZnfQZGHVTFzPbfwdpDVnwMFm7pm3Ox6NF2HX/UrtaE6WhLu3IoMU6qnRBPw/DIj p6ARSiTZX05tWTjycv4BRRT4eQwsslVLeDZCGyUhcdw3+03JtZRelRY9fgHnCDXwlDTd +KbtA91CwD0QHZAZJAn3RzqLOYOwSdw8E50xWN7QpaFU7d6VYSzcCKL4HzXUWbjDELsH nE/M7zLf5Thgry48T/GtDHNYzd/jwsaWXac3akTGw3F4x7BS4tZfWiV2dgIRqCAOT/ZM iycGuPmC7wH59Y6RhUyQPl3k2a5eQQBNCnRVEud48o7Bno3BjKytrOaTVNlzmQqOONbI loGg== 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=8XUldcaZHxbdS38yMqUjothAKxShZkmBxLmC9QQ8XEQ=; fh=MLBwLfNGz/Mw8SedRrEO4V0fPkuQvlvrrXxcgrsU4T8=; b=jhdIW8hJPMPoRCVAueKIQaF9j7RVdUrwikZiIhDCYnh+R0glDqLyCakm4kv0i37MNd oW5BYTibVoaQOer2LRRX5Qw1MTPns/LkYfGKZVdUeCADiBpUetCclbHLChHXPlwkYlMj Jlw3pYmxkv1FrVHQDVHqOjff4OAskZlngefXJUTXU1IgBxEH1Voq9u/Ms+zc0ZM4yxs0 9L1xIIZuGLLdAl5I1VNvzNVxXc5v02cxTxuGmABfpzzVvj0w02NbwbsvEZqbF1EOay/3 vzEE4vIWeyrpGfVuypYEowOuTQHtbbxEj+ZSwos7f4EH7REmdA+/vyWFBov86pqzQdul ydYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mwA9qcQ7; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m67-20020a632646000000b0055768bf4256si19460405pgm.525.2023.07.03.06.04.18; Mon, 03 Jul 2023 06:04:34 -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=@linuxfoundation.org header.s=korg header.b=mwA9qcQ7; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230416AbjGCMp0 (ORCPT + 99 others); Mon, 3 Jul 2023 08:45:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjGCMpZ (ORCPT ); Mon, 3 Jul 2023 08:45:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DE15BC; Mon, 3 Jul 2023 05:45:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF23260F1E; Mon, 3 Jul 2023 12:45:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7B49C433C7; Mon, 3 Jul 2023 12:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1688388323; bh=aPhviO+6gR3kw19K1RPOfSMPLnc5aEdn3cO2oF8ecBE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mwA9qcQ7EoE0uU+5LDOVbwvV0l+VLBzBd0BpMHA1z3wg9/xoTqu0K0sQzeHf26Csi khDJkCglgQuP1ps9tE5eIK33+0jaOXWuNtYKew7Rf3sqDXxl/KeB1BT3oxa602StNY ZbEDNyNeVSTQUlSG9XL0WfGLsUmAnvfgikkHHXus= Date: Mon, 3 Jul 2023 14:45:00 +0200 From: Greg Kroah-Hartman To: Arnd Bergmann Cc: Arnd Bergmann , Udipto Goswami , John Keeping , Linyu Yuan , Dan Carpenter , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: functionfs: avoid memcpy() field overflow warning Message-ID: <2023070309-outlook-predator-c3dc@gregkh> References: <20230703123053.3117488-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230703123053.3117488-1-arnd@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Mon, Jul 03, 2023 at 02:30:32PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann > > __ffs_func_bind_do_os_desc() copies both the CompatibleID and SubCompatibleID > fields of the usb_ext_compat_desc structure into an array, which triggers > a warning in the fortified memcpy(): > > In file included from drivers/usb/gadget/function/f_fs.c:17: > In file included from include/linux/string.h:254: > include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning] > __read_overflow2_field(q_size_field, size); > > Usually we can avoid this by using a struct_group() inside of the structure > definition, but this might cause problems in userspace since it is in a uapi > header. We use this in other uapi .h files, what is unique about these fields that makes it so that they can not be used? Because it's not the last field? thanks, greg k-h