From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 133745F72 for ; Mon, 10 Dec 2018 11:42:53 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2018 02:42:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,338,1539673200"; d="scan'208";a="99484406" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.93]) ([10.237.220.93]) by orsmga006.jf.intel.com with ESMTP; 10 Dec 2018 02:42:51 -0800 To: Jakub Grajciar , dev@dpdk.org References: <20181210091457.6031-1-jgrajcia@cisco.com> <20181210100639.30244-1-jgrajcia@cisco.com> From: "Burakov, Anatoly" Message-ID: <7ebcd985-0d04-c0e1-5411-8e02c8bc72b2@intel.com> Date: Mon, 10 Dec 2018 10:42:51 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <20181210100639.30244-1-jgrajcia@cisco.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFC v2] /net: memory interface (memif) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Dec 2018 10:42:54 -0000 On 10-Dec-18 10:06 AM, Jakub Grajciar wrote: > Signed-off-by: Jakub Grajciar > --- As a general comment, some description/cover letter would have been nice. > + > + memif_msg_disconnect_t *d = &e->msg.disconnect; > + > + e->msg.type = MEMIF_MSG_TYPE_DISCONNECT; > + d->code = err_code; > + > + if (reason != NULL) { > + strncpy((char *)d->string, reason, strlen(reason)); > + if (cc->pmd != NULL) { > + strncpy(cc->pmd->local_disc_string, reason, > + strlen(reason)); > + } I haven't looked at the entire thing, this is just something that caught my eye during quick skimming through code. On the face of it, this looks dangerous - you're setting the destination buffer size from source buffer size. What if `d->string` is shorter than `reason`? -- Thanks, Anatoly