diff for duplicates of <1491319738.2513.2.camel@sandisk.com> diff --git a/a/1.txt b/N1/1.txt index c5289e7..6029c7d 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,24 +1,17 @@ On Tue, 2017-04-04 at 12:42 +0200, Paolo Valente wrote: -> > Il giorno 31 mar 2017, alle ore 17:31, Bart Van Assche <bart.vanassche@= -sandisk.com> ha scritto: -> >=20 +> > Il giorno 31 mar 2017, alle ore 17:31, Bart Van Assche <bart.vanassche@sandisk.com> ha scritto: +> > > > On Fri, 2017-03-31 at 14:47 +0200, Paolo Valente wrote: -> > > + delta_ktime =3D ktime_get(); -> > > + delta_ktime =3D ktime_sub(delta_ktime, bfqd->last_budget_star= -t); -> > > + delta_usecs =3D ktime_to_us(delta_ktime); -> >=20 -> > This patch changes the type of the variable in which the result of ktim= -e_to_us() -> > is stored from u64 into u32 and next compares that result with LONG_MAX= -. Since -> > ktime_to_us() returns a signed 64-bit number, are you sure you want to = -store that -> > result in a 32-bit variable? If ktime_to_us() would e.g. return 0xfffff= -fff00000100 -> > or 0x100000100 then the assignment will truncate these numbers to 0x100= -. ->=20 +> > > + delta_ktime = ktime_get(); +> > > + delta_ktime = ktime_sub(delta_ktime, bfqd->last_budget_start); +> > > + delta_usecs = ktime_to_us(delta_ktime); +> > +> > This patch changes the type of the variable in which the result of ktime_to_us() +> > is stored from u64 into u32 and next compares that result with LONG_MAX. Since +> > ktime_to_us() returns a signed 64-bit number, are you sure you want to store that +> > result in a 32-bit variable? If ktime_to_us() would e.g. return 0xffffffff00000100 +> > or 0x100000100 then the assignment will truncate these numbers to 0x100. +> > The instruction above the assignment you highlight stores in > delta_ktime the difference between 'now' and the last budget start. > The latter may have happened at most about 100 ms before 'now'. So @@ -26,12 +19,10 @@ fff00000100 Hello Paolo, -Please double check the following code: if (delta_usecs < 1000 || delta_use= -cs >=3D LONG_MAX) -Since delta_usecs is a 32-bit variable and LONG_MAX a 64-bit constant on 64= --bit systems +Please double check the following code: if (delta_usecs < 1000 || delta_usecs >= LONG_MAX) +Since delta_usecs is a 32-bit variable and LONG_MAX a 64-bit constant on 64-bit systems I'm not sure that code will do what it is intended to do. Thanks, -Bart.= +Bart. diff --git a/a/content_digest b/N1/content_digest index 60821f0..69358e2 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -18,26 +18,19 @@ "\00:1\0" "b\0" "On Tue, 2017-04-04 at 12:42 +0200, Paolo Valente wrote:\n" - "> > Il giorno 31 mar 2017, alle ore 17:31, Bart Van Assche <bart.vanassche@=\n" - "sandisk.com> ha scritto:\n" - "> >=20\n" + "> > Il giorno 31 mar 2017, alle ore 17:31, Bart Van Assche <bart.vanassche@sandisk.com> ha scritto:\n" + "> > \n" "> > On Fri, 2017-03-31 at 14:47 +0200, Paolo Valente wrote:\n" - "> > > + delta_ktime =3D ktime_get();\n" - "> > > + delta_ktime =3D ktime_sub(delta_ktime, bfqd->last_budget_star=\n" - "t);\n" - "> > > + delta_usecs =3D ktime_to_us(delta_ktime);\n" - "> >=20\n" - "> > This patch changes the type of the variable in which the result of ktim=\n" - "e_to_us()\n" - "> > is stored from u64 into u32 and next compares that result with LONG_MAX=\n" - ". Since\n" - "> > ktime_to_us() returns a signed 64-bit number, are you sure you want to =\n" - "store that\n" - "> > result in a 32-bit variable? If ktime_to_us() would e.g. return 0xfffff=\n" - "fff00000100\n" - "> > or 0x100000100 then the assignment will truncate these numbers to 0x100=\n" - ".\n" - ">=20\n" + "> > > + delta_ktime = ktime_get();\n" + "> > > + delta_ktime = ktime_sub(delta_ktime, bfqd->last_budget_start);\n" + "> > > + delta_usecs = ktime_to_us(delta_ktime);\n" + "> > \n" + "> > This patch changes the type of the variable in which the result of ktime_to_us()\n" + "> > is stored from u64 into u32 and next compares that result with LONG_MAX. Since\n" + "> > ktime_to_us() returns a signed 64-bit number, are you sure you want to store that\n" + "> > result in a 32-bit variable? If ktime_to_us() would e.g. return 0xffffffff00000100\n" + "> > or 0x100000100 then the assignment will truncate these numbers to 0x100.\n" + "> \n" "> The instruction above the assignment you highlight stores in\n" "> delta_ktime the difference between 'now' and the last budget start.\n" "> The latter may have happened at most about 100 ms before 'now'. So\n" @@ -45,14 +38,12 @@ "\n" "Hello Paolo,\n" "\n" - "Please double check the following code: if (delta_usecs < 1000 || delta_use=\n" - "cs >=3D LONG_MAX)\n" - "Since delta_usecs is a 32-bit variable and LONG_MAX a 64-bit constant on 64=\n" - "-bit systems\n" + "Please double check the following code: if (delta_usecs < 1000 || delta_usecs >= LONG_MAX)\n" + "Since delta_usecs is a 32-bit variable and LONG_MAX a 64-bit constant on 64-bit systems\n" "I'm not sure that code will do what it is intended to do.\n" "\n" "Thanks,\n" "\n" - Bart.= + Bart. -1015808d2d7847ee59ab9a2ef6f2cc15d1434a3f9d50fe87d94a2cb121aec566 +5ca2ee354c8fda91872082e5c6dead4406f21f9f308bdb5eead429e18b1c7958
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.