From patchwork Fri Sep 5 10:09:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siva Durga Prasad Paladugu X-Patchwork-Id: 386291 X-Patchwork-Delegate: l.majewski@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id F3BF91400F0 for ; Fri, 5 Sep 2014 20:10:19 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3F247A73E2; Fri, 5 Sep 2014 12:10:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lCkhspvfzVJP; Fri, 5 Sep 2014 12:10:18 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C029FA73E8; Fri, 5 Sep 2014 12:10:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B710EA73E8 for ; Fri, 5 Sep 2014 12:10:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l1bvq3YaUn+t for ; Fri, 5 Sep 2014 12:10:06 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1blp0188.outbound.protection.outlook.com [207.46.163.188]) by theia.denx.de (Postfix) with ESMTPS id 7580CA73E2 for ; Fri, 5 Sep 2014 12:10:01 +0200 (CEST) Received: from BL2FFO11FD041.protection.gbl (10.173.160.30) by BL2FFO11HUB052.protection.gbl (10.173.161.128) with Microsoft SMTP Server (TLS) id 15.0.1010.11; Fri, 5 Sep 2014 10:09:59 +0000 Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2FFO11FD041.mail.protection.outlook.com (10.173.161.137) with Microsoft SMTP Server (TLS) id 15.0.1010.11 via Frontend Transport; Fri, 5 Sep 2014 10:09:59 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-smtp1) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1XPqOb-0003UP-5O for u-boot@lists.denx.de; Fri, 05 Sep 2014 03:05:33 -0700 From: Siva Durga Prasad Paladugu To: Date: Fri, 5 Sep 2014 15:39:53 +0530 X-Mailer: git-send-email 1.7.4 X-TM-AS-Product-Ver: IMSS-7.1.0.1224-7.5.0.1018-20918.005 X-TM-AS-Result: No--4.945-5.0-31-1 X-imss-scan-details: No--4.945-5.0-31-1 Message-ID: <852fe9de-b219-4301-bb9a-e9dd023abd8d@BL2FFO11FD041.protection.gbl> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.83; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(438002)(189002)(199003)(47776003)(102836001)(64706001)(20776003)(104166001)(31696002)(80022001)(31966008)(76482001)(50986999)(88136002)(50466002)(89996001)(83072002)(104016003)(74316001)(85852003)(1496007)(48376002)(87936001)(79102001)(110136001)(74502001)(74662001)(92566001)(92726001)(93916002)(575784001)(86362001)(87286001)(77982001)(62966002)(53416004)(21056001)(99396002)(50226001)(46102001)(81542001)(4396001)(77096002)(70736001)(81342001)(19580405001)(83322001)(44976005)(85306004)(229853001)(106466001)(107046002)(6806004)(19580395003)(95666004)(90102001)(2351001)(77156001)(107986001)(23106004); DIR:OUT; SFP:; SCL:1; SRVR:BL2FFO11HUB052; H:xsj-pvapsmtpgw01; FPR:; MLV:sfv; PTR:unknown-60-83.xilinx.com; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 0325F6C77B Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=siva.durga.paladugu@xilinx.com; X-OriginatorOrg: xilinx.com Cc: michals@xilinx.com, Siva Durga Prasad Paladugu Subject: [U-Boot] [UBOOT PATCH] usb: gadget: f_thor: Allocate request up to THOR_PACKET_SIZE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Allocate request up to THOR_PACKET_SIZE not the ep0->maxpacket as the descriptors data depend on the number of descriptors and this 64 bytes were not enough and the buffer might overflow which results in memalign failures later. Signed-off-by: Siva Durga Prasad Paladugu Tested-by: Michal Simek --- drivers/usb/gadget/f_thor.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index c85b0fb..98d2d8c 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -766,7 +766,7 @@ static int thor_func_bind(struct usb_configuration *c, struct usb_function *f) goto fail; } dev->req->buf = memalign(CONFIG_SYS_CACHELINE_SIZE, - gadget->ep0->maxpacket); + THOR_PACKET_SIZE); if (!dev->req->buf) { status = -ENOMEM; goto fail;