[PATCH strace v2] Implement decoding of RXRPC_* control messages

Dmitry V. Levin ldv at strace.io
Wed Jun 7 18:15:54 UTC 2023


On Wed, May 31, 2023 at 03:42:39PM +0100, David Howells wrote:
[...]
> +static void
> +print_cmsg_rxrpc_user_call_id(struct tcb *tcp, const void *cmsg_data,
> +			      const unsigned int data_len)
> +{
> +	const unsigned int *p = cmsg_data;
> +
> +	/* Size is "unsigned long" but we might be stracing a 32-bit program
> +	 * from a 64-bit strace or vice versa.
> +	 */
> +	switch (data_len) {
> +	case 4:
> +		print_local_array_ex(tcp, p, 1, 4,
> +				     print_xint_array_member, NULL, 0, NULL, NULL);
> +		break;
> +	case 8:
> +		print_local_array_ex(tcp, p, 1, 8,
> +				     print_xint_array_member, NULL, 0, NULL, NULL);
> +		break;

Could these two cases be merged?  For example,

	switch (data_len) {
	case 4:
	case 8:
		print_local_array_ex(tcp, p, 1, data_len,
				     print_xint_array_member, NULL, 0, NULL, NULL);
		break;


-- 
ldv


More information about the Strace-devel mailing list