From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BC1B6C4332F for ; Wed, 16 Feb 2022 09:19:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D562510E845; Wed, 16 Feb 2022 09:19:41 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id C423D10E800; Wed, 16 Feb 2022 09:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645003179; x=1676539179; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=W7JJ5S6ygKVdkRCpl3XvCOgtF+37zc1PmPKZVKrCQZU=; b=BetgSctASbOnsKjtu2tYJm0zQjAFuTAlSoZ122CQZvFO1fXt3Y7hRANb XlYxELmwUKHqqV9vRVfkm4GxBG1rln/7/BBOShz+psLWCBM5U2cegeGqd ACdJeVxU9fsKdYW8uOlNrcKf0dG9C8iFcZsVCTkgIyfIgomK5WtfLbq/V Hm1t0+zThtyS1U9wJA6MJfhBakwG4zicxnHA1CwUGr21FknsBMMLdLNhD yrZs8paTlHdJh6lecGZum+sPaagk/3U/TSn+anV+F4U+PxYKnZ80piIjt MAGKZ7hg96FAiRzPPwFN6RNhaxAAHLmdPgCUEmbfs7t65lri5HeY2x60K A==; X-IronPort-AV: E=McAfee;i="6200,9189,10259"; a="250760605" X-IronPort-AV: E=Sophos;i="5.88,373,1635231600"; d="scan'208";a="250760605" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2022 01:19:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,373,1635231600"; d="scan'208";a="498578877" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.151]) by orsmga006.jf.intel.com with SMTP; 16 Feb 2022 01:19:34 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 16 Feb 2022 11:19:33 +0200 Date: Wed, 16 Feb 2022 11:19:33 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Jani Nikula Message-ID: References: <20220216083849.91239-1-jiapeng.chong@linux.alibaba.com> <87h78z5gmp.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87h78z5gmp.fsf@intel.com> X-Patchwork-Hint: comment Subject: Re: [Intel-gfx] [PATCH] drm/i915/gt: fix unsigned integer to signed assignment X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiapeng Chong , airlied@linux.ie, intel-gfx@lists.freedesktop.org, Abaci Robot , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, sumit.semwal@linaro.org, linaro-mm-sig@lists.linaro.org, christian.koenig@amd.com, linux-media@vger.kernel.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Wed, Feb 16, 2022 at 11:02:06AM +0200, Jani Nikula wrote: > On Wed, 16 Feb 2022, Jiapeng Chong wrote: > > Eliminate the follow smatch warning: > > > > drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:4640 > > guc_create_virtual() warn: assigning (-2) to unsigned variable > > 've->base.instance'. > > > > drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:4641 > > guc_create_virtual() warn: assigning (-2) to unsigned variable > > 've->base.uabi_instance'. > > > > Reported-by: Abaci Robot > > Signed-off-by: Jiapeng Chong > > The report seems to be valid, but I don't think this is the fix. > > Where do we even check for invalid instance/uabi_instance in code? The whole thing seems rather poorly documented as there's a matching uabi struct with __u16's and the negative values are defined right there in the uapi header as well. > > BR, > Jani. > > > > --- > > drivers/gpu/drm/i915/gt/intel_engine_types.h | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h > > index 36365bdbe1ee..dc7cc06c68e7 100644 > > --- a/drivers/gpu/drm/i915/gt/intel_engine_types.h > > +++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h > > @@ -328,10 +328,10 @@ struct intel_engine_cs { > > intel_engine_mask_t logical_mask; > > > > u8 class; > > - u8 instance; > > + s8 instance; > > > > u16 uabi_class; > > - u16 uabi_instance; > > + s16 uabi_instance; > > > > u32 uabi_capabilities; > > u32 context_size; > > -- > Jani Nikula, Intel Open Source Graphics Center -- Ville Syrjälä Intel