Re: [PATCH] media: camss: csiphy-3ph: avoid undefined behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 16, 2022, at 12:23, Peter Zijlstra wrote:
> On Thu, Dec 15, 2022 at 05:28:46PM +0100, Arnd Bergmann wrote:
>> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
>> index 451a4c9b3d30..04baa80494c6 100644
>> --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
>> +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
>> @@ -429,7 +429,8 @@ static void csiphy_gen2_config_lanes(struct csiphy_device *csiphy,
>>  		array_size = ARRAY_SIZE(lane_regs_sm8250[0]);
>>  		break;
>>  	default:
>> -		unreachable();
>> +		WARN(1, "unknown cspi version\n");
>> +		return;
>>  	}
>
> So no real objection here; but unreachable() does have an objtool
> annotation inside, so clearly the compiler managed to defeat that --
> perhaps we should look at that too.

Ah, I forgot this annotation existed. I see that this
particular objtool warning only happens with clang (I used
version 14.0.6), but it does not happen with gcc-12.2.

I see the function ends in

	jmp	.LBB3_45
.LBB3_54:
	#APP
.Ltmp0:
	.section	.discard.unreachable,"",@progbits
.Ltmp1:
	.long	.Ltmp0-.Ltmp1
	.text
 	#NO_APP
.Lfunc_end3:
	.size	csiphy_lanes_enable, .Lfunc_end3-csiphy_lanes_enable
                                        # -- End function


full assembler output at https://pastebin.com/F8HGCUvk, object file
attached.

    Arnd

Attachment: camss-csiphy-3ph-1-0.o.xz
Description: application/xz


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux