Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp112085imm; Mon, 4 Jun 2018 14:03:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJJR2l6dOvxJTkil/CrB5vxONfs4dLBkpPE43MQXjd/U12H0t1vfrluoJbuUYso53rwoNPy X-Received: by 2002:a17:902:57d8:: with SMTP id g24-v6mr11533719plj.116.1528146188956; Mon, 04 Jun 2018 14:03:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528146188; cv=none; d=google.com; s=arc-20160816; b=aNzz7yoeKmBuvoZUtkZ/F2Y++wZRZlsD16J6dNaGU2DVz8GlYpGhBixh2t8/CS+Ugf AP3o6hjqn+0Ke5yxBPTou1Wx/zQBQ/H4cj2F9vFgdz/zglOBkSGLFSk3BuB/9mAHNaH6 k13r2KgblFqAKOOzUSVqc85b9Jr2VYDvI9mxZ9S1SR4M/PhqtwNdn0YRvItX4eUCscPl JftB1ob1D4PqoBWAfdV55KW0D8Cl2Geh9ninjScb9JIHEZHlLrlQFxzH1xHErvDT27DE MfqtS44/Pz4fHYTTTwGxwPY2Nas3DhIS/LI8O2EUavO7SXmNY+94UzX9gXN9JU+3g+u/ I8Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=NOD527vnZJxvbMmt6TFDJ+Zu2icxxqQ8+SPJGwcO6Dk=; b=mGBorCgKyERNIFyH2m7sKASqMm0vD+lmKibLrRV1hQNsP3YBWlkFbVeHoyX//3aVgK kGT+TFyY4+fqkUFzggCLUm7wzsQATvw95yayHw3B60cySIr1KECmdqKUbrAnV+txLTqg UGmGl7aN6aP7yKdT9jEl86D+IvQ1TJTwaOUPpdB75bKHGfv0z6bxKn09uwJ+gYWpxdkC vGhDEEsfxxBzOCdV0p4oexPXqeJVtkqex0Sws9dhR14ZKptuVfTUbEFwpBN0SdwqNMON nIWPuUGo1mdRCP5WjcVuVx9U++VEHb/3E1gbjjqPr7NHEQLZ+3CPzn362MCE+Y2mq0/m bYMg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g125-v6si36403409pgc.568.2018.06.04.14.02.54; Mon, 04 Jun 2018 14:03:08 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751492AbeFDVCQ (ORCPT + 99 others); Mon, 4 Jun 2018 17:02:16 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:47383 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751093AbeFDVCN (ORCPT ); Mon, 4 Jun 2018 17:02:13 -0400 Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Mon, 4 Jun 2018 14:02:00 -0700 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 4E012B0B78; Mon, 4 Jun 2018 14:02:13 -0700 (PDT) From: Nadav Amit To: Laurent Pinchart , Mauro Carvalho Chehab CC: Nadav Amit , , Subject: [PATCH] usb: fix uvc_alloc_entity() allocation alignment Date: Mon, 4 Jun 2018 06:47:13 -0700 Message-ID: <20180604134713.101064-1-namit@vmware.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-002.vmware.com: namit@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The use of ALIGN() in uvc_alloc_entity() is incorrect, since the size of (entity->pads) is not a power of two. As a stop-gap, until a better solution is adapted, use roundup() instead. Found by a static assertion. Compile-tested only. Fixes: 4ffc2d89f38a ("uvcvideo: Register subdevices for each entity") Cc: Laurent Pinchart Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Nadav Amit --- drivers/media/usb/uvc/uvc_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 2469b49b2b30..6b989d41c034 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -909,7 +909,7 @@ static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id, unsigned int size; unsigned int i; - extra_size = ALIGN(extra_size, sizeof(*entity->pads)); + extra_size = roundup(extra_size, sizeof(*entity->pads)); num_inputs = (type & UVC_TERM_OUTPUT) ? num_pads : num_pads - 1; size = sizeof(*entity) + extra_size + sizeof(*entity->pads) * num_pads + num_inputs; -- 2.17.0