[{"id":1752655,"web_url":"http://patchwork.ozlabs.org/comment/1752655/","msgid":"<0cba7bc6-6d4d-de3f-73a9-450f9dd36946@denx.de>","list_archive_url":null,"date":"2017-08-21T10:29:06","subject":"Re: [swupdate] [PATCH resent] IPC: don't zero ipc_postupdate()'s\n\tmsg parameter","submitter":{"id":5771,"url":"http://patchwork.ozlabs.org/api/people/5771/","name":"Stefano Babic","email":"sbabic@denx.de"},"content":"On 17/08/2017 15:26, Christian Storm wrote:\n> When signaling the due execution of postupdate() via\n> ipc_postupdate(), zero out msg preserving msg.data.instmsg.buf\n> so that an optional message can be forwarded to postupdate().\n> \n> Signed-off-by: Christian Storm <christian.storm@siemens.com>\n> ---\n>  ipc/network_ipc.c | 14 ++++++++++++++\n>  1 file changed, 14 insertions(+)\n> \n> diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c\n> index 0f346ba..6629461 100644\n> --- a/ipc/network_ipc.c\n> +++ b/ipc/network_ipc.c\n> @@ -78,7 +78,21 @@ int ipc_postupdate(ipc_message *msg) {\n>  \t}\n>  \n>  \tssize_t ret;\n> +\tchar* tmpbuf = NULL;\n> +\tif (msg->data.instmsg.len > 0) {\n> +\t\tif ((tmpbuf = strndupa(msg->data.instmsg.buf,\n> +\t\t\t\tmsg->data.instmsg.len > sizeof(msg->data.instmsg.buf)\n> +\t\t\t\t    ? sizeof(msg->data.instmsg.buf)\n> +\t\t\t\t    : msg->data.instmsg.len)) == NULL) {\n> +\t\t\tclose(connfd);\n> +\t\t\treturn -1;\n> +\t\t}\n> +\t}\n>  \tmemset(msg, 0, sizeof(*msg));\n> +\tif (tmpbuf != NULL) {\n> +\t\tstrncpy(msg->data.instmsg.buf, tmpbuf, sizeof(msg->data.instmsg.buf));\n> +\t\tmsg->data.instmsg.len = strnlen(tmpbuf, sizeof(msg->data.instmsg.buf));\n> +\t}\n>  \tmsg->magic = IPC_MAGIC;\n>  \tmsg->type = POST_UPDATE;\n>  \tret = write(connfd, msg, sizeof(*msg));\n> \n\nApplied to -master, thanks !\n\nBest regards,\nStefano Babic","headers":{"Return-Path":"<swupdate+bncBAABB57L5LGAKGQEJT4JIRY@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=googlegroups.com\n\t(client-ip=2a00:1450:400c:c0c::23f;\n\thelo=mail-wr0-x23f.google.com;\n\tenvelope-from=swupdate+bncbaabb57l5lgakgqejt4jiry@googlegroups.com;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=googlegroups.com header.i=@googlegroups.com\n\theader.b=\"lfWoOn27\"; dkim-atps=neutral"],"Received":["from mail-wr0-x23f.google.com (mail-wr0-x23f.google.com\n\t[IPv6:2a00:1450:400c:c0c::23f])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xbVKl5HPzz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 21 Aug 2017 20:29:14 +1000 (AEST)","by mail-wr0-x23f.google.com with SMTP id z91sf3802976wrc.2\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 21 Aug 2017 03:29:14 -0700 (PDT)","by 10.28.0.78 with SMTP id 75ls23509wma.16.gmail; Mon, 21 Aug 2017\n\t03:29:11 -0700 (PDT)","from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.10])\n\tby gmr-mx.google.com with ESMTPS id\n\tw5si6008wmw.4.2017.08.21.03.29.10 for <swupdate@googlegroups.com>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 21 Aug 2017 03:29:10 -0700 (PDT)","from frontend01.mail.m-online.net (unknown [192.168.8.182])\n\tby mail-out.m-online.net (Postfix) with ESMTP id 3xbVKf5vTPz1r779;\n\tMon, 21 Aug 2017 12:29:10 +0200 (CEST)","from localhost (dynscan1.mnet-online.de [192.168.6.70])\n\tby mail.m-online.net (Postfix) with ESMTP id 3xbVKf4vFdz3j37G;\n\tMon, 21 Aug 2017 12:29:10 +0200 (CEST)","from mail.mnet-online.de ([192.168.8.182])\n\tby localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new,\n\tport 10024)\n\twith ESMTP id 5PU_-202Yitk; Mon, 21 Aug 2017 12:29:09 +0200 (CEST)","from babic.homelinux.org\n\t(host-88-217-136-221.customer.m-online.net [88.217.136.221])\n\t(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mail.mnet-online.de (Postfix) with ESMTPS;\n\tMon, 21 Aug 2017 12:29:09 +0200 (CEST)","from localhost (mail.babic.homelinux.org [127.0.0.1])\n\tby babic.homelinux.org (Postfix) with ESMTP id 87D3745404AE;\n\tMon, 21 Aug 2017 12:29:09 +0200 (CEST)","from babic.homelinux.org ([127.0.0.1])\n\tby localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new,\n\tport 10024)\n\twith ESMTP id zedSrtXiaYnv; Mon, 21 Aug 2017 12:29:07 +0200 (CEST)","from [192.168.178.132] (papero.fritz.box [192.168.178.132])\n\tby babic.homelinux.org (Postfix) with ESMTP id D7CD6454019C;\n\tMon, 21 Aug 2017 12:29:06 +0200 (CEST)"],"ARC-Seal":["i=2; a=rsa-sha256; t=1503311351; cv=pass;\n\td=google.com; s=arc-20160816;\n\tb=amGveYcErlw47VAk30BsO+dClR1VuVs8AuVQSIRMby3wJrpkL9vjvzgwKyCE6cOMcJ\n\tHJSHV6yoJBTbLgI8Gnfdo7/oqzZsq5825xwR+8vb+8RIaY9PGJPONtXKF5wn5ji4xxbw\n\tXz8WE1c+v5ZAjdXaNOWPPPYSHY+sAgvpSAO6Lgvbsr51uKMh5lJHyFpJ+v39ACNu9op8\n\tgELW89kTj6Hwbffrbba1zA2oZ/gArq/0dktc2rl2lvoWotkyqphZXKsUL4ai3Zjpdh63\n\tB3AfETyRxNIviy3noeyUcNYb5HnpIVBbw4zIlS+AAheY1L90D61m/YiD+UHSkjmwjAIP\n\t4v3Q==","i=1; a=rsa-sha256; t=1503311351; cv=none;\n\td=google.com; s=arc-20160816;\n\tb=QETmFYPGLsoqcnQb9feIaz2PttIhl+mB9AkuDvRhSCvbg6ZoIbD/5iZVNYKbMxnIvk\n\tXsJd4L5AqkdISZ9AAsUJEvf86A8HgQyuZL4XAPyN9QdotM9AqWt8EM7VVJ32p9DJbU64\n\tWQbqA1D6t8QtFokE327fSCjZOd6ETpL7K4kT9Djnvb3LMt74gBjTPRI8xzWCJZOoZ6vJ\n\t9siV4h9CSTYuFgJ2QmfYGx3HmlwGoIYS1bA4ol5kvonwI2JK0c1jIHSQDdqBFO3+yWag\n\tki3ExzOOSgEBKLtg0l4Nl/F9magwqjRV1VarS7fkdxBQFK7rZUckA7aY3enROHzddTI5\n\t0rzQ=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20160816; \n\th=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n\t:list-id:mailing-list:precedence:content-language:in-reply-to\n\t:mime-version:user-agent:date:message-id:from:references:to:subject\n\t:arc-authentication-results:arc-message-signature:sender\n\t:dkim-signature:arc-authentication-results;\n\tbh=Y5Ys6HfXwAAKN4TbtxRs5HFF2TosXpEh9Q08b0zt81s=;\n\tb=Y+ofXBPjtTEQRiwNxegHwKyRuZ8MmTJFVTp+zYCOn1MkLEClOPl15SwnZMJb7jUR2N\n\t1ggD3OSJ7JynvjqkwU/YAYcr3HEMZv4kUvp154e2TKBqioFpMze8pD8jpkXdcrtGoQ+U\n\tiznF53CRE99PAsVYaSm9EoTxEr0EJzdPRy84hqFum3CDND3Du87K7dH8WA764gJpUplX\n\t2mNsxx87DOwuTyGqLNdVQFE6klWQ9EinRw+9YQyQo20OG5s5IpWJGVU4zIxXtKZz/aG6\n\trooVBrTiUyDheIkRn0TdoEdOZmfPoXD+6tSeacA0RFVBmpee3wcuMg+WJ+3ltf6GQ1Qq\n\tBUrQ==","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20160816; \n\th=content-transfer-encoding:content-language:in-reply-to:mime-version\n\t:user-agent:date:message-id:from:references:to:subject\n\t:arc-authentication-results;\n\tbh=jF9xsZoczk3mw6WlWiCkfySZfk1OLk3hr8x6S6urdwU=;\n\tb=L3/EDJZ6cuvc5yjm62VUhMQ7H9X95yYnyFfgzDXJDecnY36++9u8m1rOsJVx+gOgy6\n\t1nGoQRR3GPVbsnzaiLJgMmUZunJ1XuC/VaIW6PTr26teYGYPiLTUxbz19/z98gOYv8hW\n\tPHug9i4tr+lba8CPdvBzzNEgZzHPbSKO7uOJHWqbddDLRGBKw3qcfLXCt8jY3kaby/Jv\n\teFR50ZRVmYpz9+6dCr0AnHHWHWN8VuxoLMOXGdxzpQ6c4zJqGaGW4CYmyYlVuqo3Wtgy\n\tqgzsjncfN45Avt27NDdHUxcAbBPFVqwWrrGhLj+fUYAYwE3Iqp4El1ZZooRn5Lz++PYP\n\t0BPQ=="],"ARC-Authentication-Results":["i=2; gmr-mx.google.com;\n\tspf=neutral (google.com: 212.18.0.10 is neither permitted nor denied\n\tby best guess record for domain of sbabic@denx.de)\n\tsmtp.mailfrom=sbabic@denx.de","i=1; gmr-mx.google.com;\n\tspf=neutral (google.com: 212.18.0.10 is neither permitted nor denied\n\tby best guess record for domain of sbabic@denx.de)\n\tsmtp.mailfrom=sbabic@denx.de"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=googlegroups.com; s=20161025;\n\th=sender:subject:to:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:x-original-sender\n\t:x-original-authentication-results:precedence:mailing-list:list-id\n\t:list-post:list-help:list-archive:list-subscribe:list-unsubscribe;\n\tbh=Y5Ys6HfXwAAKN4TbtxRs5HFF2TosXpEh9Q08b0zt81s=;\n\tb=lfWoOn27uZRWXVzwT2NA6V+scZWUqSfqLl8fBDtqodtwZb8I+h3cWeKod8d83Ik/hd\n\tZfEZ/LLCQQkJiFt++hvPLM8Ths6Go6ewr8/jK2x/1EJ2A9Spv4RWtfyoo5NJi+UfXVCc\n\tEbYCeXF5TbH3OL19y9yuF8SNl54t/g5rsZsUM4Wjqp1FPUzuwSWl3KqdHxCmXNQyhz0l\n\tZ2ySID1CTt0I9oYLma/iiKeIb51FAhEsZw1+i+epuvcCqYSEpyWnbqikMbE8X1WBOu39\n\tUJo4HyURiPT4J5U604Ki89lgc693Y11MTdtwD/wrBwKYJbjhZWsKp12ZVErPfUne7ITt\n\tVzQA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=sender:x-gm-message-state:subject:to:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:x-original-sender:x-original-authentication-results:precedence\n\t:mailing-list:list-id:x-spam-checked-in-group:list-post:list-help\n\t:list-archive:list-subscribe:list-unsubscribe;\n\tbh=Y5Ys6HfXwAAKN4TbtxRs5HFF2TosXpEh9Q08b0zt81s=;\n\tb=h60fv43Qyr0OJM0clvcLjAUgfyRfXg29O8jBRPHV1RJnt5mgZGpRClxRD32v002t4Y\n\t4+8CGUd1QZnF2uiPsuyThgLCVapVj8xi5oKabDfik5JE7m+9/Fu4Nz3kKU7oi+L9lSDC\n\tk5Olvjnt+ecmAWk5jn5M7AzBW62ZTuljZXJcVIxviHiBnuTX3Ar4oQz4oDEThr4StXKq\n\tdb1Yi7eOHy3Y4Ljv9HbukCtV+CfHw4jPJkKHj4326N2BAU5BahEnwTPVwS97sDiA8sa+\n\tboOopnJKWPme7EiZg/NrXX7gjHXqFLN5TFbiE8Gkw/1LDouGzcRUiKk+tzvxvtJU+7Hw\n\t0EFw==","Sender":"swupdate@googlegroups.com","X-Gm-Message-State":"AHYfb5j5W+7bJ1lIVtfw+qmbdh2iz6G42EsuseCRLWeypQhlAw0PCT0y\n\t3+EoRbwVWu6wAA==","X-Received":["by 10.28.14.80 with SMTP id 77mr13396wmo.18.1503311351536;\n\tMon, 21 Aug 2017 03:29:11 -0700 (PDT)","by 10.223.182.169 with SMTP id j41mr781634wre.5.1503311351125;\n\tMon, 21 Aug 2017 03:29:11 -0700 (PDT)"],"X-BeenThere":"swupdate@googlegroups.com","Received-SPF":"neutral (google.com: 212.18.0.10 is neither permitted nor\n\tdenied by best guess record for domain of sbabic@denx.de)\n\tclient-ip=212.18.0.10; ","X-Virus-Scanned":["amavisd-new at mnet-online.de","Debian amavisd-new at babic.homelinux.org"],"Subject":"Re: [swupdate] [PATCH resent] IPC: don't zero ipc_postupdate()'s\n\tmsg parameter","To":"Christian Storm <christian.storm@siemens.com>, swupdate@googlegroups.com","References":"<20170817132614.17160-1-christian.storm@siemens.com>","From":"Stefano Babic <sbabic@denx.de>","Message-ID":"<0cba7bc6-6d4d-de3f-73a9-450f9dd36946@denx.de>","Date":"Mon, 21 Aug 2017 12:29:06 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<20170817132614.17160-1-christian.storm@siemens.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Language":"en-GB","X-Original-Sender":"sbabic@denx.de","X-Original-Authentication-Results":"gmr-mx.google.com;       spf=neutral\n\t(google.com: 212.18.0.10 is neither permitted nor denied by best\n\tguess record\n\tfor domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de","Precedence":"list","Mailing-list":"list swupdate@googlegroups.com;\n\tcontact swupdate+owners@googlegroups.com","List-ID":"<swupdate.googlegroups.com>","X-Spam-Checked-In-Group":"swupdate@googlegroups.com","X-Google-Group-Id":"605343134186","List-Post":"<https://groups.google.com/group/swupdate/post>,\n\t<mailto:swupdate@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n\t<mailto:swupdate+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/swupdate","List-Subscribe":"<https://groups.google.com/group/swupdate/subscribe>,\n\t<mailto:swupdate+subscribe@googlegroups.com>","List-Unsubscribe":"<mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,\n\t<https://groups.google.com/group/swupdate/subscribe>"}}]