lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1448460036.2877.80.camel@suse.de>
Date:	Wed, 25 Nov 2015 15:00:36 +0100
From:	Johannes Thumshirn <jthumshirn@...e.de>
To:	Geliang Tang <geliangtang@....com>,
	"Nicholas A. Bellinger" <nab@...ux-iscsi.org>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Bart Van Assche <bart.vanassche@...disk.com>
Cc:	linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] target: use offset_in_page macro

On Wed, 2015-11-25 at 21:49 +0800, Geliang Tang wrote:
> Use offset_in_page macro instead of (addr & ~PAGE_MASK).
> 
> Signed-off-by: Geliang Tang <geliangtang@....com>
> ---
>  drivers/target/target_core_user.c | 2 +-
>  drivers/target/tcm_fc/tfc_io.c    | 8 ++++----
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/target/target_core_user.c
> b/drivers/target/target_core_user.c
> index 937cebf..d5477c0 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -194,7 +194,7 @@ static struct tcmu_cmd *tcmu_alloc_cmd(struct se_cmd
> *se_cmd)
>  
>  static inline void tcmu_flush_dcache_range(void *vaddr, size_t size)
>  {
> -	unsigned long offset = (unsigned long) vaddr & ~PAGE_MASK;
> +	unsigned long offset = offset_in_page(vaddr);
>  
>  	size = round_up(size+offset, PAGE_SIZE);
>  	vaddr -= offset;
> diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c
> index 847c1aa..6f7c65a 100644
> --- a/drivers/target/tcm_fc/tfc_io.c
> +++ b/drivers/target/tcm_fc/tfc_io.c
> @@ -154,9 +154,9 @@ int ft_queue_data_in(struct se_cmd *se_cmd)
>  			BUG_ON(!page);
>  			from = kmap_atomic(page + (mem_off >> PAGE_SHIFT));
>  			page_addr = from;
> -			from += mem_off & ~PAGE_MASK;
> +			from += offset_in_page(mem_off);
>  			tlen = min(tlen, (size_t)(PAGE_SIZE -
> -						(mem_off & ~PAGE_MASK)));
> +						offset_in_page(mem_off)));
>  			memcpy(to, from, tlen);
>  			kunmap_atomic(page_addr);
>  			to += tlen;
> @@ -314,9 +314,9 @@ void ft_recv_write_data(struct ft_cmd *cmd, struct
> fc_frame *fp)
>  
>  		to = kmap_atomic(page + (mem_off >> PAGE_SHIFT));
>  		page_addr = to;
> -		to += mem_off & ~PAGE_MASK;
> +		to += offset_in_page(mem_off);
>  		tlen = min(tlen, (size_t)(PAGE_SIZE -
> -					  (mem_off & ~PAGE_MASK)));
> +					  offset_in_page(mem_off)));
>  		memcpy(to, from, tlen);
>  		kunmap_atomic(page_addr);
>  

Reviewed-by: Johannes Thumshirn <jthumshirn@...e.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ