On 05-Jan-19 19:09, Aditya Pakki wrote: > > static int ib_nl_get_path_rec_attrs_len(ib_sa_comp_mask comp_mask) > @@ -856,7 +873,10 @@ static int ib_nl_send_msg(struct ib_sa_query *query, gfp_t gfp_mask) > } > > /* Add attributes */ > - ib_nl_set_path_rec_attrs(skb, query); > + if (ib_nl_set_path_rec_attrs(skb, query, nlh)) { > + nlmsg_free(skb); > + return -EMSGSIZE; > + } IMO, it's better to return the error code of ib_nl_set_path_rec_attrs instead of an explicit -EMSGSIZE.