Skip to content

Commit

Permalink
pinctrl: Ensure aligned accesses when processing DNS.
Browse files Browse the repository at this point in the history
UB Sanitizer report:
  controller/pinctrl.c:2945:33: runtime error: load of misaligned address 0x000002ce5407 for type 'const ovs_be16', which requires 2 byte alignment
  0x000002ce5407: note: pointer points here
   6f 72 67 00 00  01 00 01 00 00 00 00 00  00 03 00 05 00 00 00 00  00 04 00 10 00 00 00 00  00 00 00
               ^
      #0 0x46d12d in pinctrl_handle_dns_lookup controller/pinctrl.c:2945
      #1 0x46e6fa in process_packet_in controller/pinctrl.c:3186
      [...]

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Numan Siddique <numans@ovn.org>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
  • Loading branch information
dceara authored and putnopvut committed Jan 6, 2022
1 parent e0f8ed5 commit c77d7c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controller/pinctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2932,7 +2932,7 @@ pinctrl_handle_dns_lookup(
goto exit;
}

uint16_t query_type = ntohs(*ALIGNED_CAST(const ovs_be16 *, in_dns_data));
uint16_t query_type = ntohs(get_unaligned_be16((void *) in_dns_data));
/* Supported query types - A, AAAA, ANY and PTR */
if (!(query_type == DNS_QUERY_TYPE_A || query_type == DNS_QUERY_TYPE_AAAA
|| query_type == DNS_QUERY_TYPE_ANY
Expand Down

0 comments on commit c77d7c8

Please sign in to comment.