Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1538109yba; Fri, 17 May 2019 00:32:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsgSfWXzAhQLEosgA8NbSwtUJAkRKZHWBaSjsFNv+RGnXPLVOG6R+cB5YPdFVoTm81+511 X-Received: by 2002:a65:500d:: with SMTP id f13mr57002100pgo.250.1558078331594; Fri, 17 May 2019 00:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558078331; cv=none; d=google.com; s=arc-20160816; b=LoYWhi1twu9ge6OR6YPfDDqR8VEzRb3cdlGAhQjOmWcjZ0Nkni83ouB7n5wjCqncR1 21lK78fMnu4OC1U06D+VlweFPW/UNyOWAz++qNkS4yGihWSAwNIFK5uX4v0/tvi5d8E+ iF434Tc46qOP0b4GK1oerI3TtHAWYkiSP/V7FqokuNVmxa9NR7XdsLrnZxiBIh0r/Yv0 G4CrLbCjSpAQHJtoJnh5wH4jCUapEs26p8+23TdQdQ8I+QQPJn4Dmj1CYutvAV1woktN xiebY22j7bsbVFy5AmR2HzQ9OBOyY/s0ks9XjJv6ZZrEokBu59gNzDGQWFjt6issYn8f i4Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:message-id:date:subject:cc:to :from; bh=wx98kolV97v3A/9HyQGatOERS6WoR9v0bEENd2+RAYI=; b=QhdwS8tSX80bA4yjZUpZ0vdwQsLawdhnwmZ6gAFlMSyIN7NsJHIeizIXEhaO4fR6ij 42Z7yuvNc6fidGfhBQrNkzvTOzbDzCYLB+zXXgk0LDD6OPDCcQDtbnRTjT6mc6/4qFL3 B9Npm4qHBNhBEMzge5is2gNcyS45yx7MQSYGuV0V/R4hqbB68OJh9tznyV+yyv7Upiwy 3Y/Kp6+QGhvBqmkLIC9mUuAyBn9+uFiY5zVQQKmGYst0Z4GEkLwj87qZD2T/uRQfmmPV pSfkTgwvZWUe0HHh/ji8wvHQv01J2/xpfzPU4LwROjDjZOnLysbv8sPSVQJwFLOChlFI zLhA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si7297001pgm.302.2019.05.17.00.31.56; Fri, 17 May 2019 00:32:11 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728207AbfEQHP5 (ORCPT + 99 others); Fri, 17 May 2019 03:15:57 -0400 Received: from smtpbg65.qq.com ([103.7.28.233]:41125 "EHLO smtpbg65.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728042AbfEQHP5 (ORCPT ); Fri, 17 May 2019 03:15:57 -0400 X-QQ-mid: bizesmtp16t1558077328tbi6f6eq Received: from localhost.localdomain (unknown [218.76.23.26]) by esmtp4.qq.com (ESMTP) with id ; Fri, 17 May 2019 15:15:23 +0800 (CST) X-QQ-SSF: 01400000000000H0HG32B00A0000000 X-QQ-FEAT: L3blbkxtNtm+rzjeLRXoZ87U2dRsGzkJKd3sLysIF5OldGCxQpoqhZumo3jum 6x3gEM9G6qf0l3C0nCWcEtcmUgumZ1M6+ZAaSuRl6TiaekbuNvuELF6/SYrfiPHXvRwQ+18 ypxQjiYFptwzB1Yxc9ueB0QiIijgDD+puA8rlsxL5EEj0E20oTUrvvH4SIHeX9xDxMARU3v snNP+UHs9X31GE+puCBrih71fo4kXZKrtECDILW8fK+sanJvNCBqgUXZyOyrxl8cvJUxjka Bm2joRSzQz9+m1xPv59XLHUrbjVTs4Qllc9f/HzvwvN/B7g/RjJA3kK+U= X-QQ-GoodBg: 2 From: xiaolinkui To: schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, xiaolinkui@kylinos.cn Subject: [PATCH] arch: s390: use struct_size() in kmalloc() Date: Fri, 17 May 2019 15:15:17 +0800 Message-Id: <1558077317-12201-1-git-send-email-xiaolinkui@kylinos.cn> X-Mailer: git-send-email 2.7.4 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:kylinos.cn:qybgforeign:qybgforeign4 X-QQ-Bgrelay: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the new struct_size() helper to keep code simple. Signed-off-by: xiaolinkui --- arch/s390/include/asm/idals.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/s390/include/asm/idals.h b/arch/s390/include/asm/idals.h index 15578fd..6fb7ace 100644 --- a/arch/s390/include/asm/idals.h +++ b/arch/s390/include/asm/idals.h @@ -122,8 +122,7 @@ idal_buffer_alloc(size_t size, int page_order) nr_ptrs = (size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG; nr_chunks = (4096 << page_order) >> IDA_SIZE_LOG; - ib = kmalloc(sizeof(struct idal_buffer) + nr_ptrs*sizeof(void *), - GFP_DMA | GFP_KERNEL); + ib = kmalloc(struct_size(ib, data, nr_ptrs), GFP_DMA | GFP_KERNEL); if (ib == NULL) return ERR_PTR(-ENOMEM); ib->size = size; -- 2.7.4