From patchwork Thu Jan 10 09:36:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Ramirez Luna X-Patchwork-Id: 1959181 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 37B90DF264 for ; Thu, 10 Jan 2013 09:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751911Ab3AJJhV (ORCPT ); Thu, 10 Jan 2013 04:37:21 -0500 Received: from mail-ob0-f174.google.com ([209.85.214.174]:34056 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752187Ab3AJJhU (ORCPT ); Thu, 10 Jan 2013 04:37:20 -0500 Received: by mail-ob0-f174.google.com with SMTP id ta14so331872obb.5 for ; Thu, 10 Jan 2013 01:37:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=lIjzfd0l0xl8RTYUsmGZHhJppCuMsb9jJrvOnYAD6P8=; b=IX/naF5h5cbOHnzzQhdxyC1kNwY0jQ9bpVqRRS3BLZGT5aCrcqQNFNoqYLceuAxHWD Q6koJxyS0j/qtlaAFrmPOxb+ZC9sZ4qgB+S73KCyihchcYtwYJmui0TLYgpmp009ZiQP NaG/2UW9YRoYNj1UuGFuzhvgSqr35zpyv7GFNhi5ix8qS2TcsOEYzKe7ZUcl6tUcrFVJ 3cx+mdmyISZnkewIntK8T4ZCWkhnYsBRTBUJ+b6MgMM0IIEBT90bYAIx9rtN58Qrth6v PhFJPwMxy40LKq6vIcFZ3BMYdQfTAvvdMdf7HWUhm6XmATz8G5dayYCYZU3geY2J7dRR LYCg== X-Received: by 10.60.169.240 with SMTP id ah16mr42235069oec.9.1357810639803; Thu, 10 Jan 2013 01:37:19 -0800 (PST) Received: from localhost.localdomain (cpe-76-185-160-228.tx.res.rr.com. [76.185.160.228]) by mx.google.com with ESMTPS id ag15sm826005oec.11.2013.01.10.01.37.18 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 10 Jan 2013 01:37:19 -0800 (PST) From: Omar Ramirez Luna To: Greg Kroah-Hartman Cc: Chen Gang , devel@driverdev.osuosl.org, linux-omap@vger.kernel.org, Omar Ramirez Luna Subject: [PATCH 2/5] staging: tidspbridge: fix memory corruption on long string names Date: Thu, 10 Jan 2013 03:36:59 -0600 Message-Id: <1357810622-1709-3-git-send-email-omar.ramirez@copitl.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1357810622-1709-1-git-send-email-omar.ramirez@copitl.com> References: <1357810622-1709-1-git-send-email-omar.ramirez@copitl.com> X-Gm-Message-State: ALoCoQkJ87HuSmukM6gpTwiHlAVBSOzVVWMr648Bb7BUmTmCf+4rbmijrA9RZ8PMRcLO3ZOpG7o5 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The value allocated doesn't match the one that is meant to be stored, resulting in corruption of memory for longer strings that can't be held in such space. Fix by allocating the correct byte value for the string meant to be stored. Signed-off-by: Omar Ramirez Luna --- drivers/staging/tidspbridge/rmgr/dbdcd.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c index 9d52c3c..3d2a26f 100644 --- a/drivers/staging/tidspbridge/rmgr/dbdcd.c +++ b/drivers/staging/tidspbridge/rmgr/dbdcd.c @@ -852,8 +852,7 @@ int dcd_register_object(struct dsp_uuid *uuid_obj, goto func_end; } - dcd_key->path = kmalloc(strlen(sz_reg_key) + 1, - GFP_KERNEL); + dcd_key->path = kmalloc(dw_path_size, GFP_KERNEL); if (!dcd_key->path) { kfree(dcd_key);