From owner-svn-src-stable-10@freebsd.org Sat Dec 24 14:48:29 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F154C8D13A; Sat, 24 Dec 2016 14:48:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2487A1E0A; Sat, 24 Dec 2016 14:48:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEmSct071896; Sat, 24 Dec 2016 14:48:28 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEmSLF071895; Sat, 24 Dec 2016 14:48:28 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241448.uBOEmSLF071895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310521 - stable/10/sys/dev/iicbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:48:29 -0000 Author: avg Date: Sat Dec 24 14:48:28 2016 New Revision: 310521 URL: https://svnweb.freebsd.org/changeset/base/310521 Log: MFC r308530: iicsmb: SMB_MAXBLOCKSIZE can be used again Modified: stable/10/sys/dev/iicbus/iicsmb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/iicbus/iicsmb.c ============================================================================== --- stable/10/sys/dev/iicbus/iicsmb.c Sat Dec 24 14:44:25 2016 (r310520) +++ stable/10/sys/dev/iicbus/iicsmb.c Sat Dec 24 14:48:28 2016 (r310521) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "iicbus_if.h" @@ -432,7 +433,7 @@ iicsmb_bwrite(device_t dev, u_char slave }; int error; - if (count > 32 || count == 0) + if (count > SMB_MAXBLOCKSIZE || count == 0) return (SMB_EINVAL); error = TRANSFER_MSGS(dev, msgs); return (iic2smb_error(error)); @@ -450,12 +451,6 @@ iicsmb_bread(device_t dev, u_char slave, }; device_t parent = device_get_parent(dev); int error; - u_char bufsz; - - /* Stash output buffer size before overwriting it. */ - bufsz = *count; - if (bufsz == 0) - return (SMB_EINVAL); /* Have to do this because the command is split in two transfers. */ error = iicbus_request_bus(parent, dev, IIC_WAIT); @@ -465,18 +460,13 @@ iicsmb_bread(device_t dev, u_char slave, /* * If the slave offers an empty or a too long reply, * read one byte to generate the stop or abort. - * XXX 32 is hardcoded until SMB_MAXBLOCKSIZE is restored - * to sanity. */ - if (*count > 32 || *count == 0) + if (*count > SMB_MAXBLOCKSIZE || *count == 0) block_msg[0].len = 1; - /* If longer than the buffer, then clamp at the buffer size. */ - if (*count > bufsz) - block_msg[0].len = bufsz; else block_msg[0].len = *count; error = TRANSFER_MSGS(dev, block_msg); - if (*count > 32 || *count == 0) + if (*count > SMB_MAXBLOCKSIZE || *count == 0) error = SMB_EINVAL; } (void)iicbus_release_bus(parent, dev);