Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8046527ybi; Tue, 9 Jul 2019 08:17:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQ8tm6Pw9LhI5DxHVVEHu/LoS/qn4WH45XJ1J5qT8Q1CLes7a20qQpIdeLzXXrfMXVucjY X-Received: by 2002:a65:44c8:: with SMTP id g8mr31045323pgs.443.1562685456156; Tue, 09 Jul 2019 08:17:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562685456; cv=none; d=google.com; s=arc-20160816; b=jtvTHgiGRSWcBqOE7/R8zAWU6ugyTld+lytYDEHjifBNfVnzROaAh+SElWvLa9TBxb sHr05ferhmi7gZqrpQpHIquARc599VoULQ5G5+T7qh4u+6o9Zqd4jsMrsfcLMUySo8v2 uiufign/WtRhaVVePSiQVmN4930sUgy/SnPgElEDHIzA6Edhwk0/niI7iINScoLq1Y98 SoZJhPVoBd2eo4WUAusFMDZhqUq49OFHdbr6rSAySWhi6KGKars/E0P+GVAU+38Kaj+t 95jdEOYkRhv2DXGwyLKEu0CDjR187pM/vsNr4sE1flyY5Zp6QrdFciGs0jQDoslMsbkK F2Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=FwfMmwF/+zgXHMVcTdXo+8yBqJMgxbap+eAPJWUKZPA=; b=eWXDTg4n5EPkxWNP/j3Tmlp6t3sdDd/CvCixfREqRi+KHI5nerQ3vYiG61By8gm9vg WlR+P1dEqGCmGUs8b/4pCv4geisugMK62zgOc81SuaLqm6zehKFb4CCcllggql/UiulL Gxe8Quuk5/RmxWukOfSuKQrjai4pNTvYilFM32eG0J62MhH71UdyOyxrP+97fkArXpqk 0hZHvuhp5PiFNZVot9iSQXxZUeRYnz9J8QUKiUmIQ1Eti0Lo6aWfsZTd9Sfy6iAbNNZM /V4paDt4OJXM8hrtVWjdrWoDSYKed4DYn6xlE0dji9WkWbx0JiRfr/D89ip+XdMtyvEU OxSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15si20542968ply.127.2019.07.09.08.17.19; Tue, 09 Jul 2019 08:17:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726823AbfGIPOI (ORCPT + 99 others); Tue, 9 Jul 2019 11:14:08 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:6634 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726055AbfGIPOI (ORCPT ); Tue, 9 Jul 2019 11:14:08 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x69FDkFf050305; Tue, 9 Jul 2019 11:13:54 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tmw4qgtpr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jul 2019 11:13:52 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x69FDnjx050545; Tue, 9 Jul 2019 11:13:49 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tmw4qgt1c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jul 2019 11:13:48 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x69FAKvW009798; Tue, 9 Jul 2019 15:13:06 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma03dal.us.ibm.com with ESMTP id 2tjk96nqty-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jul 2019 15:13:06 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x69FD5hS49480048 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Jul 2019 15:13:05 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 97853124052; Tue, 9 Jul 2019 15:13:05 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 739BC12405B; Tue, 9 Jul 2019 15:13:05 +0000 (GMT) Received: from localhost (unknown [9.80.239.26]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 9 Jul 2019 15:13:05 +0000 (GMT) From: Nathan Lynch To: Fuqian Huang Cc: linux-kernel@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2 03/35] powerpc: Use kmemdup rather than duplicating its implementation In-Reply-To: <20190703162643.31999-1-huangfq.daxian@gmail.com> References: <20190703162643.31999-1-huangfq.daxian@gmail.com> Date: Tue, 09 Jul 2019 10:13:05 -0500 Message-ID: <8736jfs0la.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-09_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907090180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fuqian Huang writes: > kmemdup is introduced to duplicate a region of memory in a neat way. > Rather than kmalloc/kzalloc + memcpy, which the programmer needs to > write the size twice (sometimes lead to mistakes), kmemdup improves > readability, leads to smaller code and also reduce the chances of mistakes. > Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy. > > Signed-off-by: Fuqian Huang > --- > Changes in v2: > - Fix a typo in commit message (memset -> memcpy) Thanks, but this and the unchecked kmalloc result (and incorrect gfp flags) have already been addressed in commit 348ea30f51fc63ce3c7fd7dba6043e8e3ee0ef34 ("powerpc/pseries: avoid blocking in irq when queuing hotplug events"): https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?h=next&id=348ea30f51fc63ce3c7fd7dba6043e8e3ee0ef34