From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6456 invoked by alias); 28 May 2012 09:04:34 -0000 Received: (qmail 6436 invoked by uid 22791); 28 May 2012 09:04:32 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,MAY_BE_FORGED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 May 2012 09:04:10 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4S94ALJ003701 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 28 May 2012 05:04:10 -0400 Received: from spoyarek (dhcp233-8.pnq.redhat.com [10.65.223.8] (may be forged)) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4S948J1002535; Mon, 28 May 2012 05:04:08 -0400 Date: Mon, 28 May 2012 09:04:00 -0000 From: Siddhesh Poyarekar To: binutils@sourceware.org, gdb-patches@sourceware.org Subject: [PATCH] bfd: Use size_t for length argument totarget_read_memory function passed into bfd_elf_bfd_from_remote_memory Message-ID: <20120528143437.5da0e648@spoyarek> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00987.txt.bz2 Hi, The target_read_memory function pointer that bfd_elf_bfd_from_remote_memory accepts current accepts int for length. I have attached a patch which changes this argument to size_t. This change is needed because I'm looking to make analogous changes in gdb to ensure consistency of storage sizes passed across functions to ensure that larger values are not truncated. I could write a wrapper around or cast the function pointer explicitly, but as Jan Kratochvil suggested, it would be cleaner to just make a change in bfd since it should be taking size_t values anyway. The conversation thread is here for reference: http://sourceware.org/ml/gdb-patches/2012-05/msg00909.html Attached are two patches, the first being changes to bfd and the second is the change I need to make in gdb to make it work with the changes in bfd. Regards, Siddhesh bfd/ChangeLog: 2012-05-28 Siddhesh Poyarekar * bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument of target_read_memory as size_t. * bfd-in2.h: Regenerate. * elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN argument of target_read_memory as size_t. (_bfd_elf32_bfd_from_remote_memory): Likewise. (_bfd_elf64_bfd_from_remote_memory): Likewise. * elf.c (bfd_elf_bfd_from_remote_memory): Likewise. * enfcode.h (NAME): Likewise. gdb/ChangeLog: 2012-05-28 Siddhesh Poyarekar * target.c (target_read_memory): Make LEN argument as size_t. * target.h (target_read_memory): Likewise.