Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp684258ybz; Fri, 1 May 2020 06:46:32 -0700 (PDT) X-Google-Smtp-Source: APiQypKfNg87vPwtq6JUbN7m+frUCtf9w8rbZzQsSB4OnuDvL/mcwQgLpgM6kfacw5P9vkNoH9+z X-Received: by 2002:a50:e68e:: with SMTP id z14mr3669448edm.307.1588340792162; Fri, 01 May 2020 06:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588340792; cv=none; d=google.com; s=arc-20160816; b=COCH5tcemMy4mo9xAOK55OAGjy5hRgN92OJQdLc93tlxI2HYgSzn0Q5OjpvC/BCnfJ 3GsM9JQKjn4Cz1JYrCBmb9h1YWo+UeRcEGArUglCnqHApPVDP8FOkaGuCARRKNw7Oe6n jyyazGnLlfUgAsKUOxY6r5vI9JlxbIi+LF83GGlxCfF1aOjU6vbituH5ySGgZKJ+rd3w Up6OFklOQ7ZMNCBaBb+O1V+sE79Qw2cE6WKbBiTeSce9eqPtjWgO41wEQZRgMLq/6M1P gq4pEQuMm/X8x9xnjuUTuO7IIAZaRYD++in3rHYFRaqTsRDs35I308JvXUmAGGN1GvUN Dhcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=fufigKI63pVyUaq3ivgITv7pbSzOzXF6p0tNBdZRj2M=; b=E53JbSrWRMIacYrKBsvguKn8DVvEWRUHQURaD/0kSrS4wTYqChsPRrcsotOG38IbL2 Dki0uX5wJvMyIeZifTN8/rwVtzbCwYLiU4N03pAWOeoy3l3G+a1zJ2zIx+Ph5kaQAVtO xgabiM+uvEFMk8jbN3MC5jdsVGEsSoXHPkfrkCGvIi0MMgG0au5eC/8aeitge8EWJbWy YC55cq73eLtyb505nuVa0yhFUNlNpAtIdrLIO5XluHfyl6yfYZTyDyQh4Qpay+7oojRg EEf3loZL9UyxWJ3rw+lw1I4qh5b9FK4YIOw1bh/licQWjcTeXic+Ibh6KyNa8Lh0+cvd ycMA== ARC-Authentication-Results: i=1; mx.google.com; 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 w2si1589394edx.70.2020.05.01.06.46.09; Fri, 01 May 2020 06:46:32 -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; 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 S1731798AbgEANoy (ORCPT + 99 others); Fri, 1 May 2020 09:44:54 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36174 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731770AbgEANop (ORCPT ); Fri, 1 May 2020 09:44:45 -0400 Received: by mail-lj1-f194.google.com with SMTP id u15so2664127ljd.3; Fri, 01 May 2020 06:44:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fufigKI63pVyUaq3ivgITv7pbSzOzXF6p0tNBdZRj2M=; b=Kc14vMhsTa0Rg8ljOV1XNnvTefZ0J1Tqkg4i6kZf+k3ok4YHQuhZ2uJ0sSNFxq64AQ /VxODNDpaZspnv0issrQspLi2zNro8YvGqSw+RWEvFGVJRMhFnFxET24Vbl1Va7pz9Un oSdZfTWPv+EyXAREh0xxoPPlE4f2bSvEL63Z6opawq/ngHa9HEXwkxK7ELN6lnoH+iib vaEeqxooV8MRkYeiAz26tHhkjusem03q22gvCNvnTtYl4b9FhLTFoZWErIFd0iAO6S/v BAgeoSfa4WfPZU4/MiYnDUNMHYVH9IXZ9QscwurH42k035l8Nl9wyrjo9b24DU2zqV17 Y9Vw== X-Gm-Message-State: AGi0PuYAcCnhcEumIY7wE3UYR6jER8sRfckqnDTHgxWRvjrZOmGW8sS0 Y3H+vTcHT8Y4FhwXhqb9MeKr61XOAOA= X-Received: by 2002:a2e:a37b:: with SMTP id i27mr2363790ljn.36.1588340682811; Fri, 01 May 2020 06:44:42 -0700 (PDT) Received: from localhost.localdomain ([213.87.150.177]) by smtp.googlemail.com with ESMTPSA id b2sm2269194lfi.14.2020.05.01.06.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 06:44:42 -0700 (PDT) From: Denis Efremov To: linux-block@vger.kernel.org Cc: Denis Efremov , Willy Tarreau , Christoph Hellwig , Joe Perches , linux-kernel@vger.kernel.org Subject: [PATCH v3 0/4] floppy: suppress UBSAN warning in setup_rw_floppy() Date: Fri, 1 May 2020 16:44:12 +0300 Message-Id: <20200501134416.72248-1-efremov@linux.com> X-Mailer: git-send-email 2.25.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These patches are based on Willy's cleanup patches https://lkml.org/lkml/2020/3/31/609. The first patch removes pr_cont() in setup_DMA() and prints the contents of cmd buffer with print_hex_dump(). The last patch also touches these lines and changes cmd buffer to fullcmd. The 2,3 patches introduce defines to make it more clear why cmd_count in struct floppy_raw_cmd allows out-of-bounds access for cmd, reply_count, reply fields. Last patch handles the warning. There is the checkpatch warning because of the line length 81 > 80 in the definition of valid_floppy_drive_params(). This function intentionally uses autodetect[8] as argument to highlight that this is exactly the autodetect field from structs floppy_drive_params and compat_floppy_drive_params. I think that this warning is not a big problem since next function definition is 85 chars long and whole driver requires "restyling". Changes in v3: - fix indentation in the second patch - remove FD_RAW_REPLY_SIZE from print_hex_dump() in the third patch Changes in v2: - add FD_RAW_CMD_FULLSIZE to the second patch - add union with fullcmd to struct floppy_raw_cmd in the last patch Denis Efremov (4): floppy: use print_hex_dump() in setup_DMA() floppy: add FD_AUTODETECT_SIZE define for struct floppy_drive_params floppy: add defines for sizes of cmd & reply buffers of floppy_raw_cmd floppy: suppress UBSAN warning in setup_rw_floppy() drivers/block/floppy.c | 39 ++++++++++++++------------------------- include/uapi/linux/fd.h | 26 ++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 29 deletions(-) -- 2.25.3