Skip to content

Commit 99a5e17

Browse files
keesdavem330
authored andcommitted
ATM: use designated initializers
Prepare to mark sensitive kernel structures for randomization by making sure they're using designated initializers. These were identified during allyesconfig builds of x86, arm, and arm64, with most initializer fixes extracted from grsecurity. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4794195 commit 99a5e17

4 files changed

Lines changed: 54 additions & 55 deletions

File tree

‎net/atm/lec.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry)
111111
}
112112

113113
static struct lane2_ops lane2_ops = {
114-
lane2_resolve, /* resolve, spec 3.1.3 */
115-
lane2_associate_req, /* associate_req, spec 3.1.4 */
116-
NULL /* associate indicator, spec 3.1.5 */
114+
.resolve = lane2_resolve, /* spec 3.1.3 */
115+
.associate_req = lane2_associate_req, /* spec 3.1.4 */
116+
.associate_indicator = NULL /* spec 3.1.5 */
117117
};
118118

119119
static unsigned char bus_mac[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };

‎net/atm/mpoa_caches.c‎

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -535,33 +535,32 @@ static void eg_destroy_cache(struct mpoa_client *mpc)
535535

536536

537537
static const struct in_cache_ops ingress_ops = {
538-
in_cache_add_entry, /* add_entry */
539-
in_cache_get, /* get */
540-
in_cache_get_with_mask, /* get_with_mask */
541-
in_cache_get_by_vcc, /* get_by_vcc */
542-
in_cache_put, /* put */
543-
in_cache_remove_entry, /* remove_entry */
544-
cache_hit, /* cache_hit */
545-
clear_count_and_expired, /* clear_count */
546-
check_resolving_entries, /* check_resolving */
547-
refresh_entries, /* refresh */
548-
in_destroy_cache /* destroy_cache */
538+
.add_entry = in_cache_add_entry,
539+
.get = in_cache_get,
540+
.get_with_mask = in_cache_get_with_mask,
541+
.get_by_vcc = in_cache_get_by_vcc,
542+
.put = in_cache_put,
543+
.remove_entry = in_cache_remove_entry,
544+
.cache_hit = cache_hit,
545+
.clear_count = clear_count_and_expired,
546+
.check_resolving = check_resolving_entries,
547+
.refresh = refresh_entries,
548+
.destroy_cache = in_destroy_cache
549549
};
550550

551551
static const struct eg_cache_ops egress_ops = {
552-
eg_cache_add_entry, /* add_entry */
553-
eg_cache_get_by_cache_id, /* get_by_cache_id */
554-
eg_cache_get_by_tag, /* get_by_tag */
555-
eg_cache_get_by_vcc, /* get_by_vcc */
556-
eg_cache_get_by_src_ip, /* get_by_src_ip */
557-
eg_cache_put, /* put */
558-
eg_cache_remove_entry, /* remove_entry */
559-
update_eg_cache_entry, /* update */
560-
clear_expired, /* clear_expired */
561-
eg_destroy_cache /* destroy_cache */
552+
.add_entry = eg_cache_add_entry,
553+
.get_by_cache_id = eg_cache_get_by_cache_id,
554+
.get_by_tag = eg_cache_get_by_tag,
555+
.get_by_vcc = eg_cache_get_by_vcc,
556+
.get_by_src_ip = eg_cache_get_by_src_ip,
557+
.put = eg_cache_put,
558+
.remove_entry = eg_cache_remove_entry,
559+
.update = update_eg_cache_entry,
560+
.clear_expired = clear_expired,
561+
.destroy_cache = eg_destroy_cache
562562
};
563563

564-
565564
void atm_mpoa_init_cache(struct mpoa_client *mpc)
566565
{
567566
mpc->in_ops = &ingress_ops;

‎net/vmw_vsock/vmci_transport_notify.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)
662662

663663
/* Socket control packet based operations. */
664664
const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = {
665-
vmci_transport_notify_pkt_socket_init,
666-
vmci_transport_notify_pkt_socket_destruct,
667-
vmci_transport_notify_pkt_poll_in,
668-
vmci_transport_notify_pkt_poll_out,
669-
vmci_transport_notify_pkt_handle_pkt,
670-
vmci_transport_notify_pkt_recv_init,
671-
vmci_transport_notify_pkt_recv_pre_block,
672-
vmci_transport_notify_pkt_recv_pre_dequeue,
673-
vmci_transport_notify_pkt_recv_post_dequeue,
674-
vmci_transport_notify_pkt_send_init,
675-
vmci_transport_notify_pkt_send_pre_block,
676-
vmci_transport_notify_pkt_send_pre_enqueue,
677-
vmci_transport_notify_pkt_send_post_enqueue,
678-
vmci_transport_notify_pkt_process_request,
679-
vmci_transport_notify_pkt_process_negotiate,
665+
.socket_init = vmci_transport_notify_pkt_socket_init,
666+
.socket_destruct = vmci_transport_notify_pkt_socket_destruct,
667+
.poll_in = vmci_transport_notify_pkt_poll_in,
668+
.poll_out = vmci_transport_notify_pkt_poll_out,
669+
.handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt,
670+
.recv_init = vmci_transport_notify_pkt_recv_init,
671+
.recv_pre_block = vmci_transport_notify_pkt_recv_pre_block,
672+
.recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue,
673+
.recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue,
674+
.send_init = vmci_transport_notify_pkt_send_init,
675+
.send_pre_block = vmci_transport_notify_pkt_send_pre_block,
676+
.send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue,
677+
.send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue,
678+
.process_request = vmci_transport_notify_pkt_process_request,
679+
.process_negotiate = vmci_transport_notify_pkt_process_negotiate,
680680
};

‎net/vmw_vsock/vmci_transport_notify_qstate.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(
420420

421421
/* Socket always on control packet based operations. */
422422
const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = {
423-
vmci_transport_notify_pkt_socket_init,
424-
vmci_transport_notify_pkt_socket_destruct,
425-
vmci_transport_notify_pkt_poll_in,
426-
vmci_transport_notify_pkt_poll_out,
427-
vmci_transport_notify_pkt_handle_pkt,
428-
vmci_transport_notify_pkt_recv_init,
429-
vmci_transport_notify_pkt_recv_pre_block,
430-
vmci_transport_notify_pkt_recv_pre_dequeue,
431-
vmci_transport_notify_pkt_recv_post_dequeue,
432-
vmci_transport_notify_pkt_send_init,
433-
vmci_transport_notify_pkt_send_pre_block,
434-
vmci_transport_notify_pkt_send_pre_enqueue,
435-
vmci_transport_notify_pkt_send_post_enqueue,
436-
vmci_transport_notify_pkt_process_request,
437-
vmci_transport_notify_pkt_process_negotiate,
423+
.socket_init = vmci_transport_notify_pkt_socket_init,
424+
.socket_destruct = vmci_transport_notify_pkt_socket_destruct,
425+
.poll_in = vmci_transport_notify_pkt_poll_in,
426+
.poll_out = vmci_transport_notify_pkt_poll_out,
427+
.handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt,
428+
.recv_init = vmci_transport_notify_pkt_recv_init,
429+
.recv_pre_block = vmci_transport_notify_pkt_recv_pre_block,
430+
.recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue,
431+
.recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue,
432+
.send_init = vmci_transport_notify_pkt_send_init,
433+
.send_pre_block = vmci_transport_notify_pkt_send_pre_block,
434+
.send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue,
435+
.send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue,
436+
.process_request = vmci_transport_notify_pkt_process_request,
437+
.process_negotiate = vmci_transport_notify_pkt_process_negotiate,
438438
};

0 commit comments

Comments
 (0)