diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/scsi_netlink.c | 4 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 21 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 70 |
3 files changed, 45 insertions, 50 deletions
diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c index 65123a21b97e..fe30ea94ffe6 100644 --- a/drivers/scsi/scsi_netlink.c +++ b/drivers/scsi/scsi_netlink.c | |||
@@ -50,7 +50,7 @@ scsi_nl_rcv_msg(struct sk_buff *skb) | |||
50 | u32 rlen; | 50 | u32 rlen; |
51 | int err, tport; | 51 | int err, tport; |
52 | 52 | ||
53 | while (skb->len >= NLMSG_SPACE(0)) { | 53 | while (skb->len >= NLMSG_HDRLEN) { |
54 | err = 0; | 54 | err = 0; |
55 | 55 | ||
56 | nlh = nlmsg_hdr(skb); | 56 | nlh = nlmsg_hdr(skb); |
@@ -70,7 +70,7 @@ scsi_nl_rcv_msg(struct sk_buff *skb) | |||
70 | goto next_msg; | 70 | goto next_msg; |
71 | } | 71 | } |
72 | 72 | ||
73 | hdr = NLMSG_DATA(nlh); | 73 | hdr = nlmsg_data(nlh); |
74 | if ((hdr->version != SCSI_NL_VERSION) || | 74 | if ((hdr->version != SCSI_NL_VERSION) || |
75 | (hdr->magic != SCSI_NL_MAGIC)) { | 75 | (hdr->magic != SCSI_NL_MAGIC)) { |
76 | err = -EPROTOTYPE; | 76 | err = -EPROTOTYPE; |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index e894ca7b54c0..e106c276aa00 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <scsi/scsi_transport.h> | 35 | #include <scsi/scsi_transport.h> |
36 | #include <scsi/scsi_transport_fc.h> | 36 | #include <scsi/scsi_transport_fc.h> |
37 | #include <scsi/scsi_cmnd.h> | 37 | #include <scsi/scsi_cmnd.h> |
38 | #include <linux/netlink.h> | ||
39 | #include <net/netlink.h> | 38 | #include <net/netlink.h> |
40 | #include <scsi/scsi_netlink_fc.h> | 39 | #include <scsi/scsi_netlink_fc.h> |
41 | #include <scsi/scsi_bsg_fc.h> | 40 | #include <scsi/scsi_bsg_fc.h> |
@@ -534,7 +533,7 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number, | |||
534 | struct nlmsghdr *nlh; | 533 | struct nlmsghdr *nlh; |
535 | struct fc_nl_event *event; | 534 | struct fc_nl_event *event; |
536 | const char *name; | 535 | const char *name; |
537 | u32 len, skblen; | 536 | u32 len; |
538 | int err; | 537 | int err; |
539 | 538 | ||
540 | if (!scsi_nl_sock) { | 539 | if (!scsi_nl_sock) { |
@@ -543,21 +542,19 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number, | |||
543 | } | 542 | } |
544 | 543 | ||
545 | len = FC_NL_MSGALIGN(sizeof(*event)); | 544 | len = FC_NL_MSGALIGN(sizeof(*event)); |
546 | skblen = NLMSG_SPACE(len); | ||
547 | 545 | ||
548 | skb = alloc_skb(skblen, GFP_KERNEL); | 546 | skb = nlmsg_new(len, GFP_KERNEL); |
549 | if (!skb) { | 547 | if (!skb) { |
550 | err = -ENOBUFS; | 548 | err = -ENOBUFS; |
551 | goto send_fail; | 549 | goto send_fail; |
552 | } | 550 | } |
553 | 551 | ||
554 | nlh = nlmsg_put(skb, 0, 0, SCSI_TRANSPORT_MSG, | 552 | nlh = nlmsg_put(skb, 0, 0, SCSI_TRANSPORT_MSG, len, 0); |
555 | skblen - sizeof(*nlh), 0); | ||
556 | if (!nlh) { | 553 | if (!nlh) { |
557 | err = -ENOBUFS; | 554 | err = -ENOBUFS; |
558 | goto send_fail_skb; | 555 | goto send_fail_skb; |
559 | } | 556 | } |
560 | event = NLMSG_DATA(nlh); | 557 | event = nlmsg_data(nlh); |
561 | 558 | ||
562 | INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC, | 559 | INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC, |
563 | FC_NL_ASYNC_EVENT, len); | 560 | FC_NL_ASYNC_EVENT, len); |
@@ -604,7 +601,7 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, | |||
604 | struct sk_buff *skb; | 601 | struct sk_buff *skb; |
605 | struct nlmsghdr *nlh; | 602 | struct nlmsghdr *nlh; |
606 | struct fc_nl_event *event; | 603 | struct fc_nl_event *event; |
607 | u32 len, skblen; | 604 | u32 len; |
608 | int err; | 605 | int err; |
609 | 606 | ||
610 | if (!scsi_nl_sock) { | 607 | if (!scsi_nl_sock) { |
@@ -613,21 +610,19 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, | |||
613 | } | 610 | } |
614 | 611 | ||
615 | len = FC_NL_MSGALIGN(sizeof(*event) + data_len); | 612 | len = FC_NL_MSGALIGN(sizeof(*event) + data_len); |
616 | skblen = NLMSG_SPACE(len); | ||
617 | 613 | ||
618 | skb = alloc_skb(skblen, GFP_KERNEL); | 614 | skb = nlmsg_new(len, GFP_KERNEL); |
619 | if (!skb) { | 615 | if (!skb) { |
620 | err = -ENOBUFS; | 616 | err = -ENOBUFS; |
621 | goto send_vendor_fail; | 617 | goto send_vendor_fail; |
622 | } | 618 | } |
623 | 619 | ||
624 | nlh = nlmsg_put(skb, 0, 0, SCSI_TRANSPORT_MSG, | 620 | nlh = nlmsg_put(skb, 0, 0, SCSI_TRANSPORT_MSG, len, 0); |
625 | skblen - sizeof(*nlh), 0); | ||
626 | if (!nlh) { | 621 | if (!nlh) { |
627 | err = -ENOBUFS; | 622 | err = -ENOBUFS; |
628 | goto send_vendor_fail_skb; | 623 | goto send_vendor_fail_skb; |
629 | } | 624 | } |
630 | event = NLMSG_DATA(nlh); | 625 | event = nlmsg_data(nlh); |
631 | 626 | ||
632 | INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC, | 627 | INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC, |
633 | FC_NL_ASYNC_EVENT, len); | 628 | FC_NL_ASYNC_EVENT, len); |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 0a74b975efdf..2e3816530bba 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -1344,8 +1344,8 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, | |||
1344 | struct iscsi_uevent *ev; | 1344 | struct iscsi_uevent *ev; |
1345 | char *pdu; | 1345 | char *pdu; |
1346 | struct iscsi_internal *priv; | 1346 | struct iscsi_internal *priv; |
1347 | int len = NLMSG_SPACE(sizeof(*ev) + sizeof(struct iscsi_hdr) + | 1347 | int len = nlmsg_total_size(sizeof(*ev) + sizeof(struct iscsi_hdr) + |
1348 | data_size); | 1348 | data_size); |
1349 | 1349 | ||
1350 | priv = iscsi_if_transport_lookup(conn->transport); | 1350 | priv = iscsi_if_transport_lookup(conn->transport); |
1351 | if (!priv) | 1351 | if (!priv) |
@@ -1360,7 +1360,7 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, | |||
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); | 1362 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); |
1363 | ev = NLMSG_DATA(nlh); | 1363 | ev = nlmsg_data(nlh); |
1364 | memset(ev, 0, sizeof(*ev)); | 1364 | memset(ev, 0, sizeof(*ev)); |
1365 | ev->transport_handle = iscsi_handle(conn->transport); | 1365 | ev->transport_handle = iscsi_handle(conn->transport); |
1366 | ev->type = ISCSI_KEVENT_RECV_PDU; | 1366 | ev->type = ISCSI_KEVENT_RECV_PDU; |
@@ -1381,7 +1381,7 @@ int iscsi_offload_mesg(struct Scsi_Host *shost, | |||
1381 | struct nlmsghdr *nlh; | 1381 | struct nlmsghdr *nlh; |
1382 | struct sk_buff *skb; | 1382 | struct sk_buff *skb; |
1383 | struct iscsi_uevent *ev; | 1383 | struct iscsi_uevent *ev; |
1384 | int len = NLMSG_SPACE(sizeof(*ev) + data_size); | 1384 | int len = nlmsg_total_size(sizeof(*ev) + data_size); |
1385 | 1385 | ||
1386 | skb = alloc_skb(len, GFP_ATOMIC); | 1386 | skb = alloc_skb(len, GFP_ATOMIC); |
1387 | if (!skb) { | 1387 | if (!skb) { |
@@ -1390,7 +1390,7 @@ int iscsi_offload_mesg(struct Scsi_Host *shost, | |||
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); | 1392 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); |
1393 | ev = NLMSG_DATA(nlh); | 1393 | ev = nlmsg_data(nlh); |
1394 | memset(ev, 0, sizeof(*ev)); | 1394 | memset(ev, 0, sizeof(*ev)); |
1395 | ev->type = type; | 1395 | ev->type = type; |
1396 | ev->transport_handle = iscsi_handle(transport); | 1396 | ev->transport_handle = iscsi_handle(transport); |
@@ -1415,7 +1415,7 @@ void iscsi_conn_error_event(struct iscsi_cls_conn *conn, enum iscsi_err error) | |||
1415 | struct sk_buff *skb; | 1415 | struct sk_buff *skb; |
1416 | struct iscsi_uevent *ev; | 1416 | struct iscsi_uevent *ev; |
1417 | struct iscsi_internal *priv; | 1417 | struct iscsi_internal *priv; |
1418 | int len = NLMSG_SPACE(sizeof(*ev)); | 1418 | int len = nlmsg_total_size(sizeof(*ev)); |
1419 | 1419 | ||
1420 | priv = iscsi_if_transport_lookup(conn->transport); | 1420 | priv = iscsi_if_transport_lookup(conn->transport); |
1421 | if (!priv) | 1421 | if (!priv) |
@@ -1429,7 +1429,7 @@ void iscsi_conn_error_event(struct iscsi_cls_conn *conn, enum iscsi_err error) | |||
1429 | } | 1429 | } |
1430 | 1430 | ||
1431 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); | 1431 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); |
1432 | ev = NLMSG_DATA(nlh); | 1432 | ev = nlmsg_data(nlh); |
1433 | ev->transport_handle = iscsi_handle(conn->transport); | 1433 | ev->transport_handle = iscsi_handle(conn->transport); |
1434 | ev->type = ISCSI_KEVENT_CONN_ERROR; | 1434 | ev->type = ISCSI_KEVENT_CONN_ERROR; |
1435 | ev->r.connerror.error = error; | 1435 | ev->r.connerror.error = error; |
@@ -1450,7 +1450,7 @@ void iscsi_conn_login_event(struct iscsi_cls_conn *conn, | |||
1450 | struct sk_buff *skb; | 1450 | struct sk_buff *skb; |
1451 | struct iscsi_uevent *ev; | 1451 | struct iscsi_uevent *ev; |
1452 | struct iscsi_internal *priv; | 1452 | struct iscsi_internal *priv; |
1453 | int len = NLMSG_SPACE(sizeof(*ev)); | 1453 | int len = nlmsg_total_size(sizeof(*ev)); |
1454 | 1454 | ||
1455 | priv = iscsi_if_transport_lookup(conn->transport); | 1455 | priv = iscsi_if_transport_lookup(conn->transport); |
1456 | if (!priv) | 1456 | if (!priv) |
@@ -1464,7 +1464,7 @@ void iscsi_conn_login_event(struct iscsi_cls_conn *conn, | |||
1464 | } | 1464 | } |
1465 | 1465 | ||
1466 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); | 1466 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); |
1467 | ev = NLMSG_DATA(nlh); | 1467 | ev = nlmsg_data(nlh); |
1468 | ev->transport_handle = iscsi_handle(conn->transport); | 1468 | ev->transport_handle = iscsi_handle(conn->transport); |
1469 | ev->type = ISCSI_KEVENT_CONN_LOGIN_STATE; | 1469 | ev->type = ISCSI_KEVENT_CONN_LOGIN_STATE; |
1470 | ev->r.conn_login.state = state; | 1470 | ev->r.conn_login.state = state; |
@@ -1484,7 +1484,7 @@ void iscsi_post_host_event(uint32_t host_no, struct iscsi_transport *transport, | |||
1484 | struct nlmsghdr *nlh; | 1484 | struct nlmsghdr *nlh; |
1485 | struct sk_buff *skb; | 1485 | struct sk_buff *skb; |
1486 | struct iscsi_uevent *ev; | 1486 | struct iscsi_uevent *ev; |
1487 | int len = NLMSG_SPACE(sizeof(*ev) + data_size); | 1487 | int len = nlmsg_total_size(sizeof(*ev) + data_size); |
1488 | 1488 | ||
1489 | skb = alloc_skb(len, GFP_NOIO); | 1489 | skb = alloc_skb(len, GFP_NOIO); |
1490 | if (!skb) { | 1490 | if (!skb) { |
@@ -1494,7 +1494,7 @@ void iscsi_post_host_event(uint32_t host_no, struct iscsi_transport *transport, | |||
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); | 1496 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); |
1497 | ev = NLMSG_DATA(nlh); | 1497 | ev = nlmsg_data(nlh); |
1498 | ev->transport_handle = iscsi_handle(transport); | 1498 | ev->transport_handle = iscsi_handle(transport); |
1499 | ev->type = ISCSI_KEVENT_HOST_EVENT; | 1499 | ev->type = ISCSI_KEVENT_HOST_EVENT; |
1500 | ev->r.host_event.host_no = host_no; | 1500 | ev->r.host_event.host_no = host_no; |
@@ -1515,7 +1515,7 @@ void iscsi_ping_comp_event(uint32_t host_no, struct iscsi_transport *transport, | |||
1515 | struct nlmsghdr *nlh; | 1515 | struct nlmsghdr *nlh; |
1516 | struct sk_buff *skb; | 1516 | struct sk_buff *skb; |
1517 | struct iscsi_uevent *ev; | 1517 | struct iscsi_uevent *ev; |
1518 | int len = NLMSG_SPACE(sizeof(*ev) + data_size); | 1518 | int len = nlmsg_total_size(sizeof(*ev) + data_size); |
1519 | 1519 | ||
1520 | skb = alloc_skb(len, GFP_NOIO); | 1520 | skb = alloc_skb(len, GFP_NOIO); |
1521 | if (!skb) { | 1521 | if (!skb) { |
@@ -1524,7 +1524,7 @@ void iscsi_ping_comp_event(uint32_t host_no, struct iscsi_transport *transport, | |||
1524 | } | 1524 | } |
1525 | 1525 | ||
1526 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); | 1526 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); |
1527 | ev = NLMSG_DATA(nlh); | 1527 | ev = nlmsg_data(nlh); |
1528 | ev->transport_handle = iscsi_handle(transport); | 1528 | ev->transport_handle = iscsi_handle(transport); |
1529 | ev->type = ISCSI_KEVENT_PING_COMP; | 1529 | ev->type = ISCSI_KEVENT_PING_COMP; |
1530 | ev->r.ping_comp.host_no = host_no; | 1530 | ev->r.ping_comp.host_no = host_no; |
@@ -1543,7 +1543,7 @@ iscsi_if_send_reply(uint32_t group, int seq, int type, int done, int multi, | |||
1543 | { | 1543 | { |
1544 | struct sk_buff *skb; | 1544 | struct sk_buff *skb; |
1545 | struct nlmsghdr *nlh; | 1545 | struct nlmsghdr *nlh; |
1546 | int len = NLMSG_SPACE(size); | 1546 | int len = nlmsg_total_size(size); |
1547 | int flags = multi ? NLM_F_MULTI : 0; | 1547 | int flags = multi ? NLM_F_MULTI : 0; |
1548 | int t = done ? NLMSG_DONE : type; | 1548 | int t = done ? NLMSG_DONE : type; |
1549 | 1549 | ||
@@ -1555,24 +1555,24 @@ iscsi_if_send_reply(uint32_t group, int seq, int type, int done, int multi, | |||
1555 | 1555 | ||
1556 | nlh = __nlmsg_put(skb, 0, 0, t, (len - sizeof(*nlh)), 0); | 1556 | nlh = __nlmsg_put(skb, 0, 0, t, (len - sizeof(*nlh)), 0); |
1557 | nlh->nlmsg_flags = flags; | 1557 | nlh->nlmsg_flags = flags; |
1558 | memcpy(NLMSG_DATA(nlh), payload, size); | 1558 | memcpy(nlmsg_data(nlh), payload, size); |
1559 | return iscsi_multicast_skb(skb, group, GFP_ATOMIC); | 1559 | return iscsi_multicast_skb(skb, group, GFP_ATOMIC); |
1560 | } | 1560 | } |
1561 | 1561 | ||
1562 | static int | 1562 | static int |
1563 | iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) | 1563 | iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) |
1564 | { | 1564 | { |
1565 | struct iscsi_uevent *ev = NLMSG_DATA(nlh); | 1565 | struct iscsi_uevent *ev = nlmsg_data(nlh); |
1566 | struct iscsi_stats *stats; | 1566 | struct iscsi_stats *stats; |
1567 | struct sk_buff *skbstat; | 1567 | struct sk_buff *skbstat; |
1568 | struct iscsi_cls_conn *conn; | 1568 | struct iscsi_cls_conn *conn; |
1569 | struct nlmsghdr *nlhstat; | 1569 | struct nlmsghdr *nlhstat; |
1570 | struct iscsi_uevent *evstat; | 1570 | struct iscsi_uevent *evstat; |
1571 | struct iscsi_internal *priv; | 1571 | struct iscsi_internal *priv; |
1572 | int len = NLMSG_SPACE(sizeof(*ev) + | 1572 | int len = nlmsg_total_size(sizeof(*ev) + |
1573 | sizeof(struct iscsi_stats) + | 1573 | sizeof(struct iscsi_stats) + |
1574 | sizeof(struct iscsi_stats_custom) * | 1574 | sizeof(struct iscsi_stats_custom) * |
1575 | ISCSI_STATS_CUSTOM_MAX); | 1575 | ISCSI_STATS_CUSTOM_MAX); |
1576 | int err = 0; | 1576 | int err = 0; |
1577 | 1577 | ||
1578 | priv = iscsi_if_transport_lookup(transport); | 1578 | priv = iscsi_if_transport_lookup(transport); |
@@ -1595,7 +1595,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) | |||
1595 | 1595 | ||
1596 | nlhstat = __nlmsg_put(skbstat, 0, 0, 0, | 1596 | nlhstat = __nlmsg_put(skbstat, 0, 0, 0, |
1597 | (len - sizeof(*nlhstat)), 0); | 1597 | (len - sizeof(*nlhstat)), 0); |
1598 | evstat = NLMSG_DATA(nlhstat); | 1598 | evstat = nlmsg_data(nlhstat); |
1599 | memset(evstat, 0, sizeof(*evstat)); | 1599 | memset(evstat, 0, sizeof(*evstat)); |
1600 | evstat->transport_handle = iscsi_handle(conn->transport); | 1600 | evstat->transport_handle = iscsi_handle(conn->transport); |
1601 | evstat->type = nlh->nlmsg_type; | 1601 | evstat->type = nlh->nlmsg_type; |
@@ -1608,12 +1608,12 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) | |||
1608 | memset(stats, 0, sizeof(*stats)); | 1608 | memset(stats, 0, sizeof(*stats)); |
1609 | 1609 | ||
1610 | transport->get_stats(conn, stats); | 1610 | transport->get_stats(conn, stats); |
1611 | actual_size = NLMSG_SPACE(sizeof(struct iscsi_uevent) + | 1611 | actual_size = nlmsg_total_size(sizeof(struct iscsi_uevent) + |
1612 | sizeof(struct iscsi_stats) + | 1612 | sizeof(struct iscsi_stats) + |
1613 | sizeof(struct iscsi_stats_custom) * | 1613 | sizeof(struct iscsi_stats_custom) * |
1614 | stats->custom_length); | 1614 | stats->custom_length); |
1615 | actual_size -= sizeof(*nlhstat); | 1615 | actual_size -= sizeof(*nlhstat); |
1616 | actual_size = NLMSG_LENGTH(actual_size); | 1616 | actual_size = nlmsg_msg_size(actual_size); |
1617 | skb_trim(skbstat, NLMSG_ALIGN(actual_size)); | 1617 | skb_trim(skbstat, NLMSG_ALIGN(actual_size)); |
1618 | nlhstat->nlmsg_len = actual_size; | 1618 | nlhstat->nlmsg_len = actual_size; |
1619 | 1619 | ||
@@ -1637,7 +1637,7 @@ int iscsi_session_event(struct iscsi_cls_session *session, | |||
1637 | struct iscsi_uevent *ev; | 1637 | struct iscsi_uevent *ev; |
1638 | struct sk_buff *skb; | 1638 | struct sk_buff *skb; |
1639 | struct nlmsghdr *nlh; | 1639 | struct nlmsghdr *nlh; |
1640 | int rc, len = NLMSG_SPACE(sizeof(*ev)); | 1640 | int rc, len = nlmsg_total_size(sizeof(*ev)); |
1641 | 1641 | ||
1642 | priv = iscsi_if_transport_lookup(session->transport); | 1642 | priv = iscsi_if_transport_lookup(session->transport); |
1643 | if (!priv) | 1643 | if (!priv) |
@@ -1653,7 +1653,7 @@ int iscsi_session_event(struct iscsi_cls_session *session, | |||
1653 | } | 1653 | } |
1654 | 1654 | ||
1655 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); | 1655 | nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); |
1656 | ev = NLMSG_DATA(nlh); | 1656 | ev = nlmsg_data(nlh); |
1657 | ev->transport_handle = iscsi_handle(session->transport); | 1657 | ev->transport_handle = iscsi_handle(session->transport); |
1658 | 1658 | ||
1659 | ev->type = event; | 1659 | ev->type = event; |
@@ -2005,7 +2005,7 @@ iscsi_send_ping(struct iscsi_transport *transport, struct iscsi_uevent *ev) | |||
2005 | static int | 2005 | static int |
2006 | iscsi_get_chap(struct iscsi_transport *transport, struct nlmsghdr *nlh) | 2006 | iscsi_get_chap(struct iscsi_transport *transport, struct nlmsghdr *nlh) |
2007 | { | 2007 | { |
2008 | struct iscsi_uevent *ev = NLMSG_DATA(nlh); | 2008 | struct iscsi_uevent *ev = nlmsg_data(nlh); |
2009 | struct Scsi_Host *shost = NULL; | 2009 | struct Scsi_Host *shost = NULL; |
2010 | struct iscsi_chap_rec *chap_rec; | 2010 | struct iscsi_chap_rec *chap_rec; |
2011 | struct iscsi_internal *priv; | 2011 | struct iscsi_internal *priv; |
@@ -2024,7 +2024,7 @@ iscsi_get_chap(struct iscsi_transport *transport, struct nlmsghdr *nlh) | |||
2024 | return -EINVAL; | 2024 | return -EINVAL; |
2025 | 2025 | ||
2026 | chap_buf_size = (ev->u.get_chap.num_entries * sizeof(*chap_rec)); | 2026 | chap_buf_size = (ev->u.get_chap.num_entries * sizeof(*chap_rec)); |
2027 | len = NLMSG_SPACE(sizeof(*ev) + chap_buf_size); | 2027 | len = nlmsg_total_size(sizeof(*ev) + chap_buf_size); |
2028 | 2028 | ||
2029 | shost = scsi_host_lookup(ev->u.get_chap.host_no); | 2029 | shost = scsi_host_lookup(ev->u.get_chap.host_no); |
2030 | if (!shost) { | 2030 | if (!shost) { |
@@ -2045,7 +2045,7 @@ iscsi_get_chap(struct iscsi_transport *transport, struct nlmsghdr *nlh) | |||
2045 | 2045 | ||
2046 | nlhchap = __nlmsg_put(skbchap, 0, 0, 0, | 2046 | nlhchap = __nlmsg_put(skbchap, 0, 0, 0, |
2047 | (len - sizeof(*nlhchap)), 0); | 2047 | (len - sizeof(*nlhchap)), 0); |
2048 | evchap = NLMSG_DATA(nlhchap); | 2048 | evchap = nlmsg_data(nlhchap); |
2049 | memset(evchap, 0, sizeof(*evchap)); | 2049 | memset(evchap, 0, sizeof(*evchap)); |
2050 | evchap->transport_handle = iscsi_handle(transport); | 2050 | evchap->transport_handle = iscsi_handle(transport); |
2051 | evchap->type = nlh->nlmsg_type; | 2051 | evchap->type = nlh->nlmsg_type; |
@@ -2058,7 +2058,7 @@ iscsi_get_chap(struct iscsi_transport *transport, struct nlmsghdr *nlh) | |||
2058 | err = transport->get_chap(shost, ev->u.get_chap.chap_tbl_idx, | 2058 | err = transport->get_chap(shost, ev->u.get_chap.chap_tbl_idx, |
2059 | &evchap->u.get_chap.num_entries, buf); | 2059 | &evchap->u.get_chap.num_entries, buf); |
2060 | 2060 | ||
2061 | actual_size = NLMSG_SPACE(sizeof(*ev) + chap_buf_size); | 2061 | actual_size = nlmsg_total_size(sizeof(*ev) + chap_buf_size); |
2062 | skb_trim(skbchap, NLMSG_ALIGN(actual_size)); | 2062 | skb_trim(skbchap, NLMSG_ALIGN(actual_size)); |
2063 | nlhchap->nlmsg_len = actual_size; | 2063 | nlhchap->nlmsg_len = actual_size; |
2064 | 2064 | ||
@@ -2096,7 +2096,7 @@ static int | |||
2096 | iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) | 2096 | iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
2097 | { | 2097 | { |
2098 | int err = 0; | 2098 | int err = 0; |
2099 | struct iscsi_uevent *ev = NLMSG_DATA(nlh); | 2099 | struct iscsi_uevent *ev = nlmsg_data(nlh); |
2100 | struct iscsi_transport *transport = NULL; | 2100 | struct iscsi_transport *transport = NULL; |
2101 | struct iscsi_internal *priv; | 2101 | struct iscsi_internal *priv; |
2102 | struct iscsi_cls_session *session; | 2102 | struct iscsi_cls_session *session; |
@@ -2263,7 +2263,7 @@ static void | |||
2263 | iscsi_if_rx(struct sk_buff *skb) | 2263 | iscsi_if_rx(struct sk_buff *skb) |
2264 | { | 2264 | { |
2265 | mutex_lock(&rx_queue_mutex); | 2265 | mutex_lock(&rx_queue_mutex); |
2266 | while (skb->len >= NLMSG_SPACE(0)) { | 2266 | while (skb->len >= NLMSG_HDRLEN) { |
2267 | int err; | 2267 | int err; |
2268 | uint32_t rlen; | 2268 | uint32_t rlen; |
2269 | struct nlmsghdr *nlh; | 2269 | struct nlmsghdr *nlh; |
@@ -2276,7 +2276,7 @@ iscsi_if_rx(struct sk_buff *skb) | |||
2276 | break; | 2276 | break; |
2277 | } | 2277 | } |
2278 | 2278 | ||
2279 | ev = NLMSG_DATA(nlh); | 2279 | ev = nlmsg_data(nlh); |
2280 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); | 2280 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); |
2281 | if (rlen > skb->len) | 2281 | if (rlen > skb->len) |
2282 | rlen = skb->len; | 2282 | rlen = skb->len; |