Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp384156ybt; Wed, 8 Jul 2020 02:15:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx26VADsf5WIfoizh9H1Q4UIH3VJylR7rOI7l5CyE6t+NPOBDKiPblIQ6rMUcbkKaZKgecr X-Received: by 2002:a05:6402:134e:: with SMTP id y14mr66414535edw.4.1594199722662; Wed, 08 Jul 2020 02:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594199722; cv=none; d=google.com; s=arc-20160816; b=FIMJVG5/tAq2yb5jCFpQ1jKlOjmJKN2iff+Sk5BvjnnE+OGp1q9SecnkP1jo236ANo nGudYPjCRtX7d77yCO1rycwCdZVmD6+xlE4sAjDdnj5ZeLi206Df/7bvd+dPeMG2g1Q1 rLB+HNp6fzHl8VEgg7ZpvX+nuIEQWX2oItftBDl7r+V7NShz7u+qydV6m1R6qtUeJI08 lZ2f0we0R210QMjyIMW0JbrnhPZa6JssJQmElXMI947dHJSG5c41L+ATHoGJkCaCgFtv UKrAoXPi2YiWZHzBcX6PDlK9D5GSncjF2eeO26QiDGDydnB3TDJjuWEop7db+mZzta48 h/4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=aiTfZkUiUmQ2Zf7S3yytWVXbZPrnvqRMBQFnt3Dign8=; b=C+KWyfMXiYK2N2PrBG6IFvrbfDuQwlh8P3oj2R/5iGokIz2Ww9j6F5EJ2z2ABpJ8pO u4j15gpRg26UBJiEpOTsIzrC7rL7sdm7c8RWa/t3/mAbbn2YtyfTqYJ3383KKA/XY3tv Aghusnfs4NnN9H6SkDqK9mU9xaoGGEC0lpw3viyDLm548CYPp0wWSFwGmdAZtScbUt5x ovX6oAIKuRD+I2pOHACNj7XQasg6MtZcHjPIr6NZmwMR4xd5QvkYjiwjxbM7IDBBpZxM 8CxPK8+Qgf83UNEgZ4wL7puVNX7eyycfmS7hEfzno4R9Ld/scZtVV9EWnaIBLUbAdeer MfPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oa24si16181968ejb.571.2020.07.08.02.14.59; Wed, 08 Jul 2020 02:15:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728168AbgGHJN2 (ORCPT + 99 others); Wed, 8 Jul 2020 05:13:28 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:23450 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727899AbgGHJN0 (ORCPT ); Wed, 8 Jul 2020 05:13:26 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06891Tv1108363; Wed, 8 Jul 2020 05:13:13 -0400 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com with ESMTP id 3259yx2nr8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jul 2020 05:13:13 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0689CmLj017489; Wed, 8 Jul 2020 09:13:11 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06fra.de.ibm.com with ESMTP id 322h1ga538-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jul 2020 09:13:11 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0689D8tR56885364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Jul 2020 09:13:08 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C95D942045; Wed, 8 Jul 2020 09:13:08 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7188642041; Wed, 8 Jul 2020 09:13:08 +0000 (GMT) Received: from linux.fritz.box (unknown [9.145.162.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 8 Jul 2020 09:13:08 +0000 (GMT) Subject: Re: [PATCH][next] s390/dasd: Use struct_size() helper To: "Gustavo A. R. Silva" , Jan Hoeppner , Heiko Carstens , Vasily Gorbik , Christian Borntraeger Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" References: <20200619165600.GA8668@embeddedor> From: Stefan Haberland Autocrypt: addr=sth@linux.ibm.com; keydata= mQINBFtGVggBEADI1Lne1npTa+b5x5EJ7ka0siRMargCCo5dcOaCBBG3wT24IyyG6chdV7Yr vkeHDm/6OjMi+w8Vbx2ts0KhYWMj9SHX2E58AsyBedeCkedOKuhkNh0HNSv8WMCEi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AltGVggCGwwFCQlmAYAACgkQ9KmDAON4ldGPmA/+L3V5wkmWZJjD ZJIvio/wHMoqObEG6MxsFvGEoSDJBBGQ5oTiysACFM2vkOaOhj2Izh2L+dbuKJIT0Qus0hUJ uEjGgIAXn7hYNeM1MMqSA81NEoCeUhNHeZudf5WSoglG3rUnxIXrnxfDkn8Vd36cinGejyrI qJoydRMpX48I3wJcyvZ8+xgM/LLlvXEH4BpuJL+vQkefJrn0R2vxTnHcj5TE1tKNwhI7/343 PNzhgHGYynjCbF4u9qpSqcJl/exFnRXaTH6POIbHXIRe8n4TfdXsOcbI3j/GUF0cXinkfxdt BWH5rC3Ng+EN3jkDo8N9qF7uEqN9rRaekqsO0jYMQJlfZeJSQH9KHD+wgZly9j6DmnGexbdB aJdzCtbIR+oJy0HjfwvIQrgp1pj0yvXeDsUHykATsORx0ZitlGUuU6tlAnbH346nNSDoklLI lEDvODTgpkhWDczM69MGKrFYgDcIqXZFWzea6Xq+cuGtGO5xV/4K+efWQovlIdv4mE4j2E2G yXj14Nuyh4wqdX9/yspSZCH1TCbXD9WEB5nQCQNAKzIB7YaTQBjFi1HFzGOGYteZGC37DJ6a xEMRG8/iNZSU4dSL+XsaTnUk5wzzSnz0QVOEOqRY5tkS3zpo9OUGevyR3R6bRqH3EaA5H1cS cH4TNHyhiR0KAbxE8qKx3Jc= Message-ID: <47a86753-fd4d-9a7a-c808-5f387c872ab3@linux.ibm.com> Date: Wed, 8 Jul 2020 11:13:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200619165600.GA8668@embeddedor> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-08_04:2020-07-08,2020-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 impostorscore=0 clxscore=1011 phishscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 priorityscore=1501 mlxscore=0 cotscore=-2147483648 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2007080062 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 19.06.20 um 18:56 schrieb Gustavo A. R. Silva: > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes. Also, remove unnecessary > variable _datasize_. > > This code was detected with the help of Coccinelle and, audited and > fixed manually. > > Signed-off-by: Gustavo A. R. Silva Thanks for the patch. Tested and applied. > --- > drivers/s390/block/dasd_diag.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c > index facb588d09e4..7f53ba015300 100644 > --- a/drivers/s390/block/dasd_diag.c > +++ b/drivers/s390/block/dasd_diag.c > @@ -506,7 +506,7 @@ static struct dasd_ccw_req *dasd_diag_build_cp(struct dasd_device *memdev, > struct req_iterator iter; > struct bio_vec bv; > char *dst; > - unsigned int count, datasize; > + unsigned int count; > sector_t recid, first_rec, last_rec; > unsigned int blksize, off; > unsigned char rw_cmd; > @@ -534,10 +534,8 @@ static struct dasd_ccw_req *dasd_diag_build_cp(struct dasd_device *memdev, > if (count != last_rec - first_rec + 1) > return ERR_PTR(-EINVAL); > /* Build the request */ > - datasize = sizeof(struct dasd_diag_req) + > - count*sizeof(struct dasd_diag_bio); > - cqr = dasd_smalloc_request(DASD_DIAG_MAGIC, 0, datasize, memdev, > - blk_mq_rq_to_pdu(req)); > + cqr = dasd_smalloc_request(DASD_DIAG_MAGIC, 0, struct_size(dreq, bio, count), > + memdev, blk_mq_rq_to_pdu(req)); > if (IS_ERR(cqr)) > return cqr; >