From patchwork Sat Dec 14 03:26:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22481 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f71.google.com (mail-vb0-f71.google.com [209.85.212.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AD65123908 for ; Sat, 14 Dec 2013 03:27:16 +0000 (UTC) Received: by mail-vb0-f71.google.com with SMTP id p6sf4672699vbe.6 for ; Fri, 13 Dec 2013 19:27:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=3mEUcpms8OE0u99Ucf3TVitYgAZkGqKX5gXEar1DghA=; b=cbysNVKDJRhj7Yrhq4VfNRGnVCsN10oatjMvZiGvw1d/2MlAPwGnP2LYnTttKq5xmR sN7CYbW30T6NZzgUgklwAGIqKq+vxTeM+tYEOR84Ov78e+A+lD05WezY5YL/fJHnTdEj JKx6W4ISYqXY6zQQgdlGKA9DRr1Oic9ec5qBXwr3k1ViW/g8UPqLsJ40X9RPnZCISajp af6d4RvaNxPyZ8miKztdGl/nCl7XxlkuGoAEsQMcZ4VpS2QFjRybnLNM2DaMyE8nDtjR sUa690M1qDZJDwIpMauzmdX5Xj1nJr8f8d3O+AmDJM7XImVtWQGZ38ywKtNVdtcj0q77 W0lw== X-Gm-Message-State: ALoCoQmSwmQW2lhj3aU+Zsku0X6TAOQYJMmm2/j3F2xLt8t3/YAjzZZbzodRPm+kHErOqqqmKPBk X-Received: by 10.236.82.206 with SMTP id o54mr1790875yhe.25.1386991636521; Fri, 13 Dec 2013 19:27:16 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.64.231 with SMTP id r7ls1303452qes.78.gmail; Fri, 13 Dec 2013 19:27:16 -0800 (PST) X-Received: by 10.220.184.70 with SMTP id cj6mr2610876vcb.23.1386991636428; Fri, 13 Dec 2013 19:27:16 -0800 (PST) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id o3si1424891ves.86.2013.12.13.19.27.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 19:27:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ia6so1845768vcb.4 for ; Fri, 13 Dec 2013 19:27:16 -0800 (PST) X-Received: by 10.58.187.81 with SMTP id fq17mr2643769vec.14.1386991636354; Fri, 13 Dec 2013 19:27:16 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp86969vcz; Fri, 13 Dec 2013 19:27:15 -0800 (PST) X-Received: by 10.68.206.171 with SMTP id lp11mr7099227pbc.109.1386991635577; Fri, 13 Dec 2013 19:27:15 -0800 (PST) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx.google.com with ESMTPS id nu5si2945754pbc.358.2013.12.13.19.27.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 19:27:15 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.54 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.54; Received: by mail-pa0-f54.google.com with SMTP id rd3so798471pab.41 for ; Fri, 13 Dec 2013 19:27:15 -0800 (PST) X-Received: by 10.66.231.6 with SMTP id tc6mr7306454pac.68.1386991634704; Fri, 13 Dec 2013 19:27:14 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id nw11sm11680086pab.13.2013.12.13.19.27.13 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 19:27:14 -0800 (PST) From: John Stultz To: LKML Cc: Greg KH , Android Kernel Team , Sumit Semwal , Jesse Barker , Colin Cross , John Stultz Subject: [PATCH 111/115] ion: add alignment check to chunk heap Date: Fri, 13 Dec 2013 19:26:31 -0800 Message-Id: <1386991595-6251-19-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386991595-6251-1-git-send-email-john.stultz@linaro.org> References: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> <1386991595-6251-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Colin Cross Signed-off-by: Colin Cross Signed-off-by: John Stultz --- drivers/staging/android/ion/ion_chunk_heap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c index f21530f..a072089 100644 --- a/drivers/staging/android/ion/ion_chunk_heap.c +++ b/drivers/staging/android/ion/ion_chunk_heap.c @@ -47,6 +47,9 @@ static int ion_chunk_heap_allocate(struct ion_heap *heap, unsigned long num_chunks; unsigned long allocated_size; + if (align > chunk_heap->chunk_size) + return -EINVAL; + allocated_size = ALIGN(size, chunk_heap->chunk_size); num_chunks = allocated_size / chunk_heap->chunk_size;