Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp232719rwd; Wed, 7 Jun 2023 23:06:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Q0uIRm+iFRzHY9SLWdCSwWG3GOV2WpkFqp7mmOBBiI/vKVN8ZtR+t/+mlMdmIY6aynAed X-Received: by 2002:a17:902:d503:b0:1b0:10a1:3da9 with SMTP id b3-20020a170902d50300b001b010a13da9mr1402097plg.32.1686204390296; Wed, 07 Jun 2023 23:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686204390; cv=none; d=google.com; s=arc-20160816; b=n2bx3yrlKWbYcu1FUtWssE58XzJatuVPZg+dWWnhWigIuPxHFAgVgklqnYuBWibS0b hZABnRYKkkQvKeTPigRUZ3kp5ubZKKakMTqVtx7lrPVAnybYAinEhqrJBLpRbaGq67Ez jgc+JKQfbEFCBDUy9b9DMVYZ2M3jzTq801KpkciwmwfKI1QshuAfY44EM2KmDwlXG+0y tpl7j3oUCRLxnAZx2gL4v751xGOh9+PcANVFUvxHBQbiXLz1/7A4YF94gbzZEbsk071F y7LkqFT5JXrv8crAWjN/JsTJe/lnwhL2eVeVNI2yS+vne+zAeTfc59Zx6YJ5SdFtOhqR 960g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BgGJFNvpgAPGAfZA4YtIcJpBl50lGIXeW2a18DMueQw=; b=M0ii/uOO7aivG4zdAIBmIxdzXWNVkMpKxC1uf/+3XoiNvJLBLYZVfWysrcf7lSWFjh nRQHxkp0f8ZsRWJo48e2Yjq2Ijb575JCrjTZjuS+ZF4651G4zZja3zvcYuUkjB2ESXdU YfFCTdaH80t0XjtQKGvOPANjh3Zvc13585qSm3uLGWSvL2gGbc0cSOZxbF+nmtGrnsNu vC1VGny2sgpnqwSTM8ELvX9NCdwwKCPA7QgQv79cHpGnMl8eoMx96du0A5v4ZsELLJRu h2zWyJ0QvOd06BX0NxTucnLxBJ0rLjq2fJi8AMAGI5wTE5uvLEkD1P3+FxaYOcnZ5IYy clig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bL0ez5aO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a170902b58300b001a6f0eab385si574128pls.55.2023.06.07.23.06.15; Wed, 07 Jun 2023 23:06:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bL0ez5aO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232031AbjFHF6C (ORCPT + 99 others); Thu, 8 Jun 2023 01:58:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231596AbjFHF57 (ORCPT ); Thu, 8 Jun 2023 01:57:59 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB4C41984; Wed, 7 Jun 2023 22:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686203878; x=1717739878; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=C6YIdimhhCSqB2aOCNA+4fKVost7ygPqKS7gSVJy1DU=; b=bL0ez5aOjxDMMDu1LoNdaYow8l2k6OzDe+GZ7eLV5azMUKp/dysw96oe 0tfkomDwIPEAGBhHKtHS3zgqArdmfUTDbtQ9zXAwpd+U1BmbU36p4vuk9 ySHKUr2F4/LSxyICduvqQ0AyarFEWZZQstsVmZvUrkRHAcvIhtqAQkg/J JGPHGZh0n3KZL2gWiTQXoNOuJeQ6XjXtSeaHdYS5IOHHARlVYPT0Z0Jhf 9Ki8teyL10kOOhjFkE4ncDY8fWQQp0mrnj+hfq8vS50Wag/Hfm4hT46Y2 AU1gnjjoQ8gUlMo6b4xTfC+8tZFj3MHyqs0xy+Ad8Ud00BH9wbyGtOtXw A==; X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="354703492" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="354703492" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 22:57:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="739563409" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="739563409" Received: from joe-255.igk.intel.com (HELO localhost) ([10.91.220.57]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 22:57:56 -0700 Date: Thu, 8 Jun 2023 07:57:54 +0200 From: Stanislaw Gruszka To: Marco Pagani Cc: Christophe JAILLET , Jacek Lawrynowicz , Oded Gabbay , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH] accel/ivpu: Use struct_size() Message-ID: <20230608055754.GD324119@linux.intel.com> References: <0ae53be873c27c9a8740c4fe6d8e7cd1b1224994.1685366864.git.christophe.jaillet@wanadoo.fr> <3475be3b-11d5-96fe-6bc4-26d0e3a270df@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3475be3b-11d5-96fe-6bc4-26d0e3a270df@redhat.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 01, 2023 at 05:58:48PM +0200, Marco Pagani wrote: > > On 2023-05-29 15:28, Christophe JAILLET wrote: > > Use struct_size() instead of hand-writing it. It is less verbose, more > > robust and more informative. > > > > Signed-off-by: Christophe JAILLET > > Reviewed-by: Marco Pagani Applied to drm-misc-next Thanks Stanislaw > > > --- > > drivers/accel/ivpu/ivpu_job.c | 4 +--- > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c > > index 3c6f1e16cf2f..0a09bba8da24 100644 > > --- a/drivers/accel/ivpu/ivpu_job.c > > +++ b/drivers/accel/ivpu/ivpu_job.c > > @@ -289,15 +289,13 @@ ivpu_create_job(struct ivpu_file_priv *file_priv, u32 engine_idx, u32 bo_count) > > { > > struct ivpu_device *vdev = file_priv->vdev; > > struct ivpu_job *job; > > - size_t buf_size; > > int ret; > > > > ret = ivpu_rpm_get(vdev); > > if (ret < 0) > > return NULL; > > > > - buf_size = sizeof(*job) + bo_count * sizeof(struct ivpu_bo *); > > - job = kzalloc(buf_size, GFP_KERNEL); > > + job = kzalloc(struct_size(job, bos, bo_count), GFP_KERNEL); > > if (!job) > > goto err_rpm_put; > > >