From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752529AbdHMKWa (ORCPT ); Sun, 13 Aug 2017 06:22:30 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:52419 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751196AbdHMKW2 (ORCPT ); Sun, 13 Aug 2017 06:22:28 -0400 Date: Sun, 13 Aug 2017 03:22:25 -0700 From: Christoph Hellwig To: Long Li Cc: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, Long Li Subject: Re: [[PATCH v1] 13/37] [CIFS] SMBD: Implement SMBD protocol negotiation Message-ID: <20170813102225.GF17287@infradead.org> References: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> <1501704648-20159-14-git-send-email-longli@exchange.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1501704648-20159-14-git-send-email-longli@exchange.microsoft.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > + request = mempool_alloc(info->request_mempool, GFP_KERNEL); > + if (!request) > + return rc; Here you do a mempool allocation to guarantee forward progress.. > + request->sge = kzalloc(sizeof(struct ib_sge), GFP_KERNEL); > + if (!request->sge) > + goto allocate_sge_failed; ... and here it's a plain malloc in the same path, which renders the above useless. Also I would just embedd the sge into the containing structure to avoid a memory allocation. > + request->info = info; > + > + packet = (struct smbd_negotiate_req *) request->packet; > + packet->min_version = cpu_to_le16(0x100); > + packet->max_version = cpu_to_le16(0x100); Canyou add a constant for the version code? > + packet->reserved = cpu_to_le16(0); no need to byte swap 0 - you can always assign it directly.