From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 42D2C386102B for ; Mon, 20 Jul 2020 13:25:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 42D2C386102B Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06KDJ5k2149499 for ; Mon, 20 Jul 2020 09:25:07 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 32d2m37jde-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 20 Jul 2020 09:25:07 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06KDOoQb009584 for ; Mon, 20 Jul 2020 13:25:06 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma01dal.us.ibm.com with ESMTP id 32brq85n55-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 20 Jul 2020 13:25:06 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06KDP5Ld53477726 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Jul 2020 13:25:05 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 71BD1AE060; Mon, 20 Jul 2020 13:25:05 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A734AE05C; Mon, 20 Jul 2020 13:25:04 +0000 (GMT) Received: from [9.163.25.90] (unknown [9.163.25.90]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 20 Jul 2020 13:25:04 +0000 (GMT) Subject: Re: [PATCH v7] string: Adds tests for test-strncasecmp and test-strncpy To: "Lucas A. M. Magalhaes" Cc: libc-alpha@sourceware.org References: <20200715131631.7528-1-rzinsly@linux.ibm.com> <159524823476.5955.986434492659002779@localhost.localdomain> From: Raphael M Zinsly Message-ID: <38127f80-5fe2-e103-9120-02ae82f2ca0c@linux.ibm.com> Date: Mon, 20 Jul 2020 10:25:03 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <159524823476.5955.986434492659002779@localhost.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-20_09:2020-07-20, 2020-07-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 clxscore=1015 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=802 bulkscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007200090 X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jul 2020 13:25:09 -0000 Hi Lucas, thanks for reviewing again, the answer is bellow: On 20/07/2020 09:30, Lucas A. M. Magalhaes wrote: > Hi Raphael. > I just have a little comment down there. The rest of the patch is good > for me. >... >> +static void >> +do_page_tests (void) >> +{ >> + CHAR *s1, *s2; >> + const size_t maxoffset = 64; >> + >> + /* Put s1 at the edge of buf1's last page. */ >> + s1 = (CHAR *) buf1 + BUF1PAGES * page_size / sizeof(CHAR) - maxoffset; >> + /* Put s2 almost at the edge of buf2, it needs room to put a string with >> + size of maxoffset + 1 at s2 + maxoffset. */ >> + s2 = (CHAR *) buf2 + page_size / sizeof(CHAR) - maxoffset * 2; >> + > It seams to me that this should be > s2 = (CHAR *) buf2 + page_size / sizeof(CHAR) - (maxoffset *2 + 1); > As if you are at point - (maxoffset * 2 + 1) and sum maxoffset you be > leaved at point - (maxoffset + 1) there for with size (maxoffset + 1). > 2 * maxoffset + 1 - maxoffset = maxoffset +1 > We are testing with maxoffset+1 to try with a size larger than the string, the string itself has size maxoffset (maxoffset-1 + \0) as you can see bellow: >> + MEMSET (s1, 'a', maxoffset - 1); >> + s1[maxoffset - 1] = '\0'; So you already have enough room for the entire string at the point with max off2 regardless of the size passed to strncpy. Best Regards, -- Raphael Moreira Zinsly IBM Linux on Power Toolchain