Received: by 10.223.185.116 with SMTP id b49csp4420480wrg; Tue, 6 Mar 2018 15:46:44 -0800 (PST) X-Google-Smtp-Source: AG47ELuiCszCc8/H8rdOTwxPpJO8sVBuV8ROX8v+CZBkpZ15mp7nGBJCP+q4PWmXB/V7zmuUdjjZ X-Received: by 2002:a17:902:6ac2:: with SMTP id i2-v6mr18023264plt.368.1520380003930; Tue, 06 Mar 2018 15:46:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520380003; cv=none; d=google.com; s=arc-20160816; b=sizdNO9qHhAVJOD+dEZN+NhpKuArpqhtYTE7MnQRE5yldPDy+krH8A6W5pxoUSZmz4 mcPuibyla/8fxNGCUXkSWzWiDdIavqQoBld+i0CRdIcJSWJ/0jCy9/vXgWfjZKIq1Fjx LGCIBJ5sr0VSAJI2gQE8l3q/HxYjRb3bOKh80Y4HuR8A/oLToXv63ObB5qxN6FCcYDJU SUro0wPiLsPChphDue/2qVWQv56/XgXDAW6lTv+lAuiRuYAmA2PBPiJNseQiI7ueHvgh 6Bm3Kk7/xpUblSsnYso91GmVI7EogLb35YhKzHGbHs3VnToKInjmfYEfonKw/CldOGrK n2sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:arc-authentication-results; bh=J9tT7adqMEZZ1hfjUj7PWtnyzuKci2R7xIgn2a2rTtA=; b=U5o5JZ/OBPqCP+VaJeq0LffeqT8R/ehfFXzKayOOzxehBdpxZ06S8d/XePfJk32QaB 6fE7XLva0Xad14z7JdcLk+LdAPaJBE3DBNXZCybIEugAi5puIbAWNg+uiiGXmCozZyJj AQzZsH+n3YXQUSbCIM2v3qZUiAPX4gH8XCudJnsXDAetM3Pbvxd6ujh+DYIisr9CvNkk 9O19c7QAxldpP7hG6/nsQv5uMHwsceeDmBlTHg4TcCYSesBMOBSiJSfU3R94oK6J67Db pGmuSCd6j97kn2fCTA4nE3p8223ny9XX/Hd1iZXiFi+bmsP6S/n/LLKiOQcX7IsDJg2A foxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10-v6si8912427plq.458.2018.03.06.15.46.29; Tue, 06 Mar 2018 15:46:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754146AbeCFXpS (ORCPT + 99 others); Tue, 6 Mar 2018 18:45:18 -0500 Received: from mga11.intel.com ([192.55.52.93]:35623 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753878AbeCFXpQ (ORCPT ); Tue, 6 Mar 2018 18:45:16 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2018 15:45:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,433,1515484800"; d="p7s'?scan'208";a="32939669" Received: from orsmsx110.amr.corp.intel.com ([10.22.240.8]) by orsmga003.jf.intel.com with ESMTP; 06 Mar 2018 15:45:16 -0800 Received: from orsmsx159.amr.corp.intel.com (10.22.240.24) by ORSMSX110.amr.corp.intel.com (10.22.240.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 6 Mar 2018 15:45:15 -0800 Received: from orsmsx101.amr.corp.intel.com ([169.254.8.72]) by ORSMSX159.amr.corp.intel.com ([169.254.11.243]) with mapi id 14.03.0319.002; Tue, 6 Mar 2018 15:45:15 -0800 From: "Derrick, Jonathan" To: "Bauer, Scott" , "jonas.rabenstein@studium.uni-erlangen.de" , "axboe@kernel.dk" CC: "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" Subject: Re: [PATCH][RESEND] block: sed-opal: fix u64 short atom length Thread-Topic: [PATCH][RESEND] block: sed-opal: fix u64 short atom length Thread-Index: AQHTsWEJmaXloMfF5ESmT6QyyCoGnaPEbbAA Date: Tue, 6 Mar 2018 23:45:14 +0000 Message-ID: <1520379912.4178.83.camel@intel.com> References: <20180301132700.1279-1-jonas.rabenstein@studium.uni-erlangen.de> In-Reply-To: <20180301132700.1279-1-jonas.rabenstein@studium.uni-erlangen.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.232.112.61] Content-Type: multipart/signed; micalg=sha-1; protocol="application/x-pkcs7-signature"; boundary="=-d8NuL9zfMejDWQd2LDRh" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-d8NuL9zfMejDWQd2LDRh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Jonas, On Thu, 2018-03-01 at 14:27 +0100, Jonas Rabenstein wrote: > The length must be given as bytes and not as 4 bit tuples. >=20 > Signed-off-by: Jonas Rabenstein n.de> > --- > block/sed-opal.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/block/sed-opal.c b/block/sed-opal.c > index 36842bfa572e..d5f565e1557a 100644 > --- a/block/sed-opal.c > +++ b/block/sed-opal.c > @@ -562,7 +562,7 @@ static void add_token_u64(int *err, struct > opal_dev *cmd, u64 number) > } > =20 > msb =3D fls(number); > - len =3D DIV_ROUND_UP(msb, 4); > + len =3D DIV_ROUND_UP(msb, 8); This change looks partially correct, but I believe we should be doing fls64() on 'number' as well. It looks like it currently coincidentally works with u64 numbers falling in 32-bit ranges. > =20 > if (cmd->pos >=3D IO_BUFFER_LENGTH - len - 1) { > pr_debug("Error adding u64: end of buffer.\n"); --=-d8NuL9zfMejDWQd2LDRh Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Disposition: attachment; filename="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIKeTCCBOsw ggPToAMCAQICEFLpAsoR6ESdlGU4L6MaMLswDQYJKoZIhvcNAQEFBQAwbzELMAkGA1UEBhMCU0Ux FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5hbCBUVFAgTmV0 d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9vdDAeFw0xMzAzMTkwMDAwMDBa Fw0yMDA1MzAxMDQ4MzhaMHkxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEUMBIGA1UEBxMLU2Fu dGEgQ2xhcmExGjAYBgNVBAoTEUludGVsIENvcnBvcmF0aW9uMSswKQYDVQQDEyJJbnRlbCBFeHRl cm5hbCBCYXNpYyBJc3N1aW5nIENBIDRBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA 4LDMgJ3YSVX6A9sE+jjH3b+F3Xa86z3LLKu/6WvjIdvUbxnoz2qnvl9UKQI3sE1zURQxrfgvtP0b Pgt1uDwAfLc6H5eqnyi+7FrPsTGCR4gwDmq1WkTQgNDNXUgb71e9/6sfq+WfCDpi8ScaglyLCRp7 ph/V60cbitBvnZFelKCDBh332S6KG3bAdnNGB/vk86bwDlY6omDs6/RsfNwzQVwo/M3oPrux6y6z yIoRulfkVENbM0/9RrzQOlyK4W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