From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K42RD-00060j-Dk for mharc-grub-devel@gnu.org; Wed, 04 Jun 2008 19:30:39 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K42RB-0005yE-Rn for grub-devel@gnu.org; Wed, 04 Jun 2008 19:30:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K42R9-0005vS-Vk for grub-devel@gnu.org; Wed, 04 Jun 2008 19:30:37 -0400 Received: from [199.232.76.173] (port=40546 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K42R9-0005vE-L4 for grub-devel@gnu.org; Wed, 04 Jun 2008 19:30:35 -0400 Received: from aybabtu.com ([69.60.117.155]:46921) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K42R9-00056y-F8 for grub-devel@gnu.org; Wed, 04 Jun 2008 19:30:35 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1K42Q9-0002Rs-JT for grub-devel@gnu.org; Thu, 05 Jun 2008 01:29:34 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1K42Qu-0005dw-31 for grub-devel@gnu.org; Thu, 05 Jun 2008 01:30:20 +0200 Date: Thu, 5 Jun 2008 01:30:19 +0200 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20080604233019.GA21645@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="azLHFNyN32YCQGCU" Content-Disposition: inline Content-Transfer-Encoding: 8bit Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] missleading function name X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jun 2008 23:30:38 -0000 --azLHFNyN32YCQGCU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit IMHO the name of this function is highly misleading. It makes one think it just checks something, but it actually modifies our variables. I think "adjust" would fit better than "check". -- Robert Millan I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.) --azLHFNyN32YCQGCU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="check_range.diff" diff -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/disk.c ./kern/disk.c --- ../grub2/kern/disk.c 2008-02-08 13:22:51.000000000 +0100 +++ ./kern/disk.c 2008-06-04 16:15:24.000000000 +0200 @@ -323,7 +323,7 @@ grub_disk_close (grub_disk_t disk) } static grub_err_t -grub_disk_check_range (grub_disk_t disk, grub_disk_addr_t *sector, +grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector, grub_off_t *offset, grub_size_t size) { *sector += *offset >> GRUB_DISK_SECTOR_BITS; @@ -364,7 +364,7 @@ grub_disk_read (grub_disk_t disk, grub_d grub_dprintf ("disk", "Reading `%s'...\n", disk->name); /* First of all, check if the region is within the disk. */ - if (grub_disk_check_range (disk, §or, &offset, size) != GRUB_ERR_NONE) + if (grub_disk_adjust_range (disk, §or, &offset, size) != GRUB_ERR_NONE) { grub_error_push (); grub_dprintf ("disk", "Read out of range: sector 0x%llx (%s).\n", @@ -502,7 +502,7 @@ grub_disk_write (grub_disk_t disk, grub_ grub_dprintf ("disk", "Writing `%s'...\n", disk->name); - if (grub_disk_check_range (disk, §or, &offset, size) != GRUB_ERR_NONE) + if (grub_disk_adjust_range (disk, §or, &offset, size) != GRUB_ERR_NONE) return -1; real_offset = offset; --azLHFNyN32YCQGCU--