[PATCH 1/1] staging: vc04_services: Use %p4cc format modifier to print FourCC codes

Greg Kroah-Hartman gregkh at linuxfoundation.org
Wed Oct 25 02:46:00 PDT 2023


On Wed, Oct 25, 2023 at 03:04:04PM +0530, Umang Jain wrote:
> 
> 
> 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 <kieran.bingham at ideasonboard.com>
> > > > Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
> > > > ---
> > > >   .../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. ?

No, that would be a separate change, this one is fine as-is.

thanks,

greg k-h



More information about the linux-arm-kernel mailing list