From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756694AbcCBATx (ORCPT ); Tue, 1 Mar 2016 19:19:53 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:58676 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932354AbcCAX5z (ORCPT ); Tue, 1 Mar 2016 18:57:55 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=Cs3mZeXfV66yLnWTyvUzJHsRqqm4j6SBbYGc1wvrVgOBcgdtSXiPXHnTDb8fcX4cwFAiZ9bcfBLI iz8ozGdq3wY6G2u7MzvooqZOK2byxdczA3C3Jnxp8BHKb4ZVmCC1NnCerJUeRoAeKwDrfNl4wrAv Vx5vvpPCSIFBANSeVDA=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 227/342] drm/qxl: use kmalloc_array to alloc reloc_info in qxl_process_single_command X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , , Gerd Hoffmann , Daniel Vetter , Dave Airlie Message-Id: <20160301234535.264829773@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.0d90fbc3a9d2401ebcc8324091794df7 X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:55:15 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gerd Hoffmann commit 34855706c30d52b0a744da44348b5d1cc39fbe51 upstream. This avoids integer overflows on 32bit machines when calculating reloc_info size, as reported by Alan Cox. Cc: gnomes@lxorguk.ukuu.org.uk Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter Signed-off-by: Dave Airlie Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/qxl/qxl_ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/qxl/qxl_ioctl.c +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c @@ -168,7 +168,8 @@ static int qxl_process_single_command(st cmd->command_size)) return -EFAULT; - reloc_info = kmalloc(sizeof(struct qxl_reloc_info) * cmd->relocs_num, GFP_KERNEL); + reloc_info = kmalloc_array(cmd->relocs_num, + sizeof(struct qxl_reloc_info), GFP_KERNEL); if (!reloc_info) return -ENOMEM;