From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7502A17EE for ; Wed, 25 Oct 2023 09:34:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KXE5rCcS" Received: from [192.168.1.110] (unknown [103.251.226.9]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 061EABD1; Wed, 25 Oct 2023 11:33:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698226440; bh=AQIUyN3q2B19i/osyY/zQtS+ykAVpqCGPNXTKZY8Ce0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=KXE5rCcS0N7b+qh+5PMe1bSMIiUHzdFHvb8PBSFOE2NmMsp9FQFdwchCzZwhmAxTG Qv/B2D0JQQtRUg4edKfCKmzmzL7BhGp8N4eqi4tHWw6pOWYybrfkgavG8AqOlf6Sqy 1vs0DA9gIq7P1i42i8n7ns9FAB6njxfbcwfjUnTk= Message-ID: Date: Wed, 25 Oct 2023 15:04:04 +0530 Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 1/1] staging: vc04_services: Use %p4cc format modifier to print FourCC codes Content-Language: en-US To: Sakari Ailus , Dan Carpenter , linux-staging@lists.linux.dev, "Ricardo B . Marliere" Cc: linux-rpi-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren , Greg Kroah-Hartman , Dan Carpenter , Kieran Bingham , Laurent Pinchart References: <20231025060717.71895-1-umang.jain@ideasonboard.com> <20231025060717.71895-2-umang.jain@ideasonboard.com> From: Umang Jain In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/25/23 2:58 PM, Sakari Ailus wrote: > On Wed, Oct 25, 2023 at 10:10:08AM +0300, Dan Carpenter wrote: >> On Wed, Oct 25, 2023 at 02:07:17AM -0400, Umang Jain wrote: >>> Drop VCHIQ_FOURCC_AS_4CHARS macro in favour of %p4cc format >>> modifier to print FourCC codes in the logs. >>> >>> vchiq_use_internal() and vchiq_release_internal() uses entity >>> character-array to store a transient string that contains >>> a FourCC code. Increase the length of entity array(to 64 bytes) >>> since %p4cc requires more bytes to hold the output characters. >>> >>> Suggested-by: Kieran Bingham >>> Signed-off-by: Umang Jain >>> --- >>> .../interface/vchiq_arm/vchiq_arm.c | 20 +++++----- >>> .../interface/vchiq_arm/vchiq_core.c | 40 +++++++++---------- >>> .../interface/vchiq_arm/vchiq_core.h | 6 --- >>> .../interface/vchiq_arm/vchiq_dev.c | 7 ++-- >>> 4 files changed, 33 insertions(+), 40 deletions(-) >>> >>> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c >>> index fc6d33ec5e95..de6a24304a4d 100644 >>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c >>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c >>> @@ -1441,7 +1441,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, >>> { >>> struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state); >>> int ret = 0; >>> - char entity[16]; >>> + char entity[64]; >>> int *entity_uc; >>> int local_uc; >>> >>> @@ -1454,8 +1454,8 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, >>> sprintf(entity, "VCHIQ: "); >>> entity_uc = &arm_state->peer_use_count; >>> } else if (service) { >>> - sprintf(entity, "%c%c%c%c:%03d", >>> - VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), >>> + sprintf(entity, "%p4cc:%03d", >> Not related to your patch but these sprintfs() make me very >> uncomfortable. >> >> KTODO: change sprintf() to snprintf() in staging/vc04_services/ > Umang: how about one patch on top of this? :-) There are just five > instances of it. Ricardo, how about this? Do you want to take a swing at this ? :-) And send a v2. ? >