Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp457548ybz; Wed, 22 Apr 2020 01:25:28 -0700 (PDT) X-Google-Smtp-Source: APiQypKBPed0bXRdbAYNMDebflglxXJsm6N3jTtwIn3B2ZQtLGSx3703j66dN6AOhRAWIaf30aJR X-Received: by 2002:aa7:dcc3:: with SMTP id w3mr21027810edu.231.1587543928664; Wed, 22 Apr 2020 01:25:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587543928; cv=none; d=google.com; s=arc-20160816; b=Imo+pNWRKlorZcKZOI935clN0XUJrhATWoMgJK7EY0BD9M1GW/o82XBUB3PzeQ4FNy F/wMrStrzCtqmI+7yeZIMiQug1Y8F/aVVFMo/B0xwwYji4I/4NzmFGqSbusZQBc351af Fm05n+MIfXkTWbtxZYoi2n/jg1bGgE2R/9ZLn8YMTBlR3n/vGZNX3N0OPfK9l4wWTJdI FsZKuiFkekXvJF1ZJOQ7imePJzVOXc0gKuSaia0sga1h7F7pk8E4hBpT8DV8Q4U8jutR gCXTUKDIFT14wLimpQELopBdanMJnkVFhGGvq0ybrY7KYsFalASOZ55UXMa4IbtVekDz eHVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6eF1L5yo0KiLrIH7uBDYUbucZy9aXiDJ2Jm6kAlHojs=; b=FJdfRqRRo7Z+/X38r9r7n+y7wDfwBFgcqPayObmYHQ7QvJ0SPqrZxHxRK4yQKdh6Zh Cd4DbcLOXWaOnzDaqseAov2pNhM4ygTeO8mSW5xpbsSqS76s/jSb5XBXu+VCukCZXPDu o9N/u5wbk0ZvL4ExE4HLuFbKqfB7BLypyFZDVgfh+e4kKEG7awF4J/f2CA2TScX/iJ8N hfVrBLQd69/tftC1ZkFNja+tBBVOBOF8k4uqCUt98I7q/SUhzb2ppcoFcua9jtYT1Yeo DAtWCffFy1ZmcfjCnJJT3dllbIyvhZArujsmEttMrqxn19X6ogsjMMRRJZkG42VgAMYB 9CZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NgeR6qbV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si2933497ejk.464.2020.04.22.01.25.05; Wed, 22 Apr 2020 01:25:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NgeR6qbV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726030AbgDVIYC (ORCPT + 99 others); Wed, 22 Apr 2020 04:24:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725786AbgDVIYB (ORCPT ); Wed, 22 Apr 2020 04:24:01 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD184C03C1A6; Wed, 22 Apr 2020 01:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6eF1L5yo0KiLrIH7uBDYUbucZy9aXiDJ2Jm6kAlHojs=; b=NgeR6qbVcrImXGvZHtTc3U0wes 1o3iMhNk54urcCjOPbOxdhDMmcFF7NMFE3YVZxt2fX6U84VVeYz5JMT2JbsDDQhSS9wMtBYIEfAm7 V928Ax1tax7PVmJXtxZB0llZBU8/A+580Plbz9u+WDfIyzEo1p+cKMeOcWg+cvjZLuL+ykqD25fZl auNPnO/wQuVk1ESEl/MQvKKhMUtC06X8TIEwC39l6F7mp4m01jYdPLI1XrGhNq0rq42lPyDuEgZya 1zdlhAgEt+PsMVin+bdTDKK7xETV6FIwa0alQuIOlbtVi+SHOXgXpOmPi1bJcg4Ss52D7KuXtBgHR DIlI4Qng==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRAfo-00089f-4G; Wed, 22 Apr 2020 08:24:00 +0000 Date: Wed, 22 Apr 2020 01:24:00 -0700 From: Christoph Hellwig To: Denis Efremov Cc: Willy Tarreau , Christoph Hellwig , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] floppy: suppress UBSAN warning in setup_rw_floppy() Message-ID: <20200422082400.GA30239@infradead.org> References: <20200421125722.58959-1-efremov@linux.com> <20200421125722.58959-4-efremov@linux.com> <20200422070921.GA19116@infradead.org> <20200422071756.GA16814@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 11:20:23AM +0300, Denis Efremov wrote: > What do you think about changing it this way? > > struct floppy_raw_cmd { > > unsigned char rate; > > -#define FD_RAW_CMD_SIZE 16 > +#define FD_RAW_CMD_SIZE 33 > #define FD_RAW_REPLY_SIZE 16 > > unsigned char cmd_count; > - unsigned char cmd[FD_RAW_CMD_SIZE]; > - unsigned char reply_count; > - unsigned char reply[FD_RAW_REPLY_SIZE]; > + union { > + struct { > + unsigned char reserved[16]; > + unsigned char reply_count; > + unsigned char reply[FD_RAW_REPLY_SIZE]; > + }; > + unsigned char cmd[FD_RAW_CMD_SIZE]; > + }; I don't think we can just change FD_RAW_CMD_SIZE or cmd as that could break userspace. But otherwise, yes something very much like that: > #define FD_RAW_CMD_SIZE 16 > #define FD_RAW_REPLY_SIZE 16 > +#define FD_RAW_FULL_CMD_SIZE (FD_RAW_CMD_SIZE + 1 + FD_RAW_CMD_SIZE) > > unsigned char cmd_count; > - unsigned char cmd[FD_RAW_CMD_SIZE]; > - unsigned char reply_count; > - unsigned char reply[FD_RAW_REPLY_SIZE]; > + union { > + struct { > + unsigned char cmd[FD_RAW_CMD_SIZE]; > + unsigned char reply_count; > + unsigned char reply[FD_RAW_REPLY_SIZE]; > + }; > + unsigned char full_cmd[FD_RAW_FULL_CMD_SIZE]; > + }; > int track; > > Denis ---end quoted text---