linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v4 1/4] devres: Provide krealloc_array
       [not found]     ` <89ad5070-db72-7bf1-5d86-a89fea54e789@arm.com>
@ 2023-05-15 11:55       ` Greg KH
  2023-05-31 22:44         ` Suzuki K Poulose
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2023-05-15 11:55 UTC (permalink / raw)
  To: James Clark
  Cc: linux-kernel, linux, michal.simek, Jonathan.Cameron,
	Jonathan Corbet, Jean Delvare, Anand Ashok Dumbre,
	Jonathan Cameron, Lars-Peter Clausen, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Jiri Slaby, linux-doc, linux-hwmon, linux-iio,
	linux-arm-kernel, linux-arm-msm, linux-serial

On Mon, May 15, 2023 at 08:55:33AM +0100, James Clark wrote:
> 
> 
> On 13/05/2023 12:04, Greg KH wrote:
> > On Tue, May 09, 2023 at 10:49:38AM +0100, James Clark wrote:
> >> There is no krealloc_array equivalent in devres. Users would have to
> >> do their own multiplication overflow check so provide one.
> >>
> >> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >> Signed-off-by: James Clark <james.clark@arm.com>
> >> ---
> >>  Documentation/driver-api/driver-model/devres.rst |  1 +
> >>  include/linux/device.h                           | 11 +++++++++++
> >>  2 files changed, 12 insertions(+)
> >>
> >> diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
> >> index 4249eb4239e0..8be086b3f829 100644
> >> --- a/Documentation/driver-api/driver-model/devres.rst
> >> +++ b/Documentation/driver-api/driver-model/devres.rst
> >> @@ -364,6 +364,7 @@ MEM
> >>    devm_kmalloc_array()
> >>    devm_kmemdup()
> >>    devm_krealloc()
> >> +  devm_krealloc_array()
> >>    devm_kstrdup()
> >>    devm_kstrdup_const()
> >>    devm_kvasprintf()
> >> diff --git a/include/linux/device.h b/include/linux/device.h
> >> index 472dd24d4823..58f4f5948edb 100644
> >> --- a/include/linux/device.h
> >> +++ b/include/linux/device.h
> >> @@ -223,6 +223,17 @@ static inline void *devm_kcalloc(struct device *dev,
> >>  {
> >>  	return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
> >>  }
> >> +static inline __realloc_size(3, 4) void * __must_check
> > 
> > Shouldn't you have a blank line before this one?
> 
> I was going for consistency with the rest of this section which doesn't
> have newlines between the functions for some reason. I can add one and
> resubmit but it might look a bit out of place?

Ah, wasn't aware of that, given the lack of context.  So nevermind, it's
fine for now.

> >> +devm_krealloc_array(struct device *dev, void *p, size_t new_n, size_t new_size, gfp_t flags)
> >> +{
> >> +	size_t bytes;
> >> +
> >> +	if (unlikely(check_mul_overflow(new_n, new_size, &bytes)))
> >> +		return NULL;
> >> +
> >> +	return devm_krealloc(dev, p, bytes, flags);
> >> +}
> > 
> > I dislike how we have to keep copying the "real" functions (i.e.
> > krealloc_array) into something like this, but I can't think of a better
> > way to do it.
> > 
> 
> Maybe something could be done with some macro magic, but it would
> probably end up being worse than just copying them and would affect the
> real ones as well. So yeah I can't think of any easy gains either.

Ok, that's good.  Given a lack of objections from others, I'll just take
this through my driver core tree in a few days.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/4] devres: Provide krealloc_array
  2023-05-15 11:55       ` [PATCH v4 1/4] devres: Provide krealloc_array Greg KH
@ 2023-05-31 22:44         ` Suzuki K Poulose
  2023-05-31 22:47           ` Suzuki K Poulose
  2023-06-01  9:33           ` Greg KH
  0 siblings, 2 replies; 8+ messages in thread
From: Suzuki K Poulose @ 2023-05-31 22:44 UTC (permalink / raw)
  To: Greg KH, James Clark; +Cc: linux-kernel, linux-arm-kernel, Coresight ML

(Removed irrelevant recipients), +Cc: coresight ml

Hi Greg,

On 15/05/2023 12:55, Greg KH wrote:
> On Mon, May 15, 2023 at 08:55:33AM +0100, James Clark wrote:
>>
>>
>> On 13/05/2023 12:04, Greg KH wrote:
>>> On Tue, May 09, 2023 at 10:49:38AM +0100, James Clark wrote:
>>>> There is no krealloc_array equivalent in devres. Users would have to
>>>> do their own multiplication overflow check so provide one.
>>>>
>>>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>>>> Signed-off-by: James Clark <james.clark@arm.com>
>>>> ---
>>>>   Documentation/driver-api/driver-model/devres.rst |  1 +
>>>>   include/linux/device.h                           | 11 +++++++++++
>>>>   2 files changed, 12 insertions(+)

...

>> Maybe something could be done with some macro magic, but it would
>> probably end up being worse than just copying them and would affect the
>> real ones as well. So yeah I can't think of any easy gains either.
> 
> Ok, that's good.  Given a lack of objections from others, I'll just take
> this through my driver core tree in a few days.

Apologies for hijacking the thread. We have a series for CoreSight[1]
that depends on this series, which I see that, is queued in your
driver-core-next.

I would like to queue [1] for the next version (as there are other
work that depend on this, e.g., [2]). Do you have any 
recommendations/comments on the proposal ? Are you able to share a
stable branch which can be merged to coresight/next and queue the
series ontop ? (PS: I haven't queued anything for coresight/next yet).

Kind regards
Suzuki





_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/4] devres: Provide krealloc_array
  2023-05-31 22:44         ` Suzuki K Poulose
@ 2023-05-31 22:47           ` Suzuki K Poulose
  2023-06-01  9:33           ` Greg KH
  1 sibling, 0 replies; 8+ messages in thread
From: Suzuki K Poulose @ 2023-05-31 22:47 UTC (permalink / raw)
  To: Greg KH, James Clark; +Cc: linux-kernel, linux-arm-kernel, Coresight ML

Hi Greg,

Links updated to the series.

On 31/05/2023 23:44, Suzuki K Poulose wrote:
> (Removed irrelevant recipients), +Cc: coresight ml
> 
> Hi Greg,
> 
> On 15/05/2023 12:55, Greg KH wrote:
>> On Mon, May 15, 2023 at 08:55:33AM +0100, James Clark wrote:
>>>
>>>
>>> On 13/05/2023 12:04, Greg KH wrote:
>>>> On Tue, May 09, 2023 at 10:49:38AM +0100, James Clark wrote:
>>>>> There is no krealloc_array equivalent in devres. Users would have to
>>>>> do their own multiplication overflow check so provide one.
>>>>>
>>>>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>>>>> Signed-off-by: James Clark <james.clark@arm.com>
>>>>> ---
>>>>>   Documentation/driver-api/driver-model/devres.rst |  1 +
>>>>>   include/linux/device.h                           | 11 +++++++++++
>>>>>   2 files changed, 12 insertions(+)
> 
> ...
> 
>>> Maybe something could be done with some macro magic, but it would
>>> probably end up being worse than just copying them and would affect the
>>> real ones as well. So yeah I can't think of any easy gains either.
>>
>> Ok, that's good.  Given a lack of objections from others, I'll just take
>> this through my driver core tree in a few days.
> 
> Apologies for hijacking the thread. We have a series for CoreSight[1]
> that depends on this series, which I see that, is queued in your
> driver-core-next.
> 
> I would like to queue [1] for the next version (as there are other
> work that depend on this, e.g., [2]). Do you have any 
> recommendations/comments on the proposal ? Are you able to share a
> stable branch which can be merged to coresight/next and queue the
> series ontop ? (PS: I haven't queued anything for coresight/next yet).

[1] https://lkml.kernel.org/r/20230425143542.2305069-1-james.clark@arm.com
[2] 
https://lkml.kernel.org/r/1682586037-25973-1-git-send-email-quic_taozha@quicinc.com


Suzuki


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/4] devres: Provide krealloc_array
  2023-05-31 22:44         ` Suzuki K Poulose
  2023-05-31 22:47           ` Suzuki K Poulose
@ 2023-06-01  9:33           ` Greg KH
  2023-06-01  9:52             ` Suzuki K Poulose
  1 sibling, 1 reply; 8+ messages in thread
From: Greg KH @ 2023-06-01  9:33 UTC (permalink / raw)
  To: Suzuki K Poulose
  Cc: James Clark, linux-kernel, linux-arm-kernel, Coresight ML

On Wed, May 31, 2023 at 11:44:55PM +0100, Suzuki K Poulose wrote:
> (Removed irrelevant recipients), +Cc: coresight ml
> 
> Hi Greg,
> 
> On 15/05/2023 12:55, Greg KH wrote:
> > On Mon, May 15, 2023 at 08:55:33AM +0100, James Clark wrote:
> > > 
> > > 
> > > On 13/05/2023 12:04, Greg KH wrote:
> > > > On Tue, May 09, 2023 at 10:49:38AM +0100, James Clark wrote:
> > > > > There is no krealloc_array equivalent in devres. Users would have to
> > > > > do their own multiplication overflow check so provide one.
> > > > > 
> > > > > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > > > Signed-off-by: James Clark <james.clark@arm.com>
> > > > > ---
> > > > >   Documentation/driver-api/driver-model/devres.rst |  1 +
> > > > >   include/linux/device.h                           | 11 +++++++++++
> > > > >   2 files changed, 12 insertions(+)
> 
> ...
> 
> > > Maybe something could be done with some macro magic, but it would
> > > probably end up being worse than just copying them and would affect the
> > > real ones as well. So yeah I can't think of any easy gains either.
> > 
> > Ok, that's good.  Given a lack of objections from others, I'll just take
> > this through my driver core tree in a few days.
> 
> Apologies for hijacking the thread. We have a series for CoreSight[1]
> that depends on this series, which I see that, is queued in your
> driver-core-next.
> 
> I would like to queue [1] for the next version (as there are other
> work that depend on this, e.g., [2]). Do you have any
> recommendations/comments on the proposal ? Are you able to share a
> stable branch which can be merged to coresight/next and queue the
> series ontop ? (PS: I haven't queued anything for coresight/next yet).

You can pull from my driver-core-next branch just fine and assume it
will be stable.  So just pull in that one commit and all should be good
in the future.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/4] devres: Provide krealloc_array
  2023-06-01  9:33           ` Greg KH
@ 2023-06-01  9:52             ` Suzuki K Poulose
  2023-06-05 13:39               ` Suzuki K Poulose
  0 siblings, 1 reply; 8+ messages in thread
From: Suzuki K Poulose @ 2023-06-01  9:52 UTC (permalink / raw)
  To: Greg KH; +Cc: James Clark, linux-kernel, linux-arm-kernel, Coresight ML

On 01/06/2023 10:33, Greg KH wrote:
> On Wed, May 31, 2023 at 11:44:55PM +0100, Suzuki K Poulose wrote:
>> (Removed irrelevant recipients), +Cc: coresight ml
>>
>> Hi Greg,
>>
>> On 15/05/2023 12:55, Greg KH wrote:
>>> On Mon, May 15, 2023 at 08:55:33AM +0100, James Clark wrote:
>>>>
>>>>
>>>> On 13/05/2023 12:04, Greg KH wrote:
>>>>> On Tue, May 09, 2023 at 10:49:38AM +0100, James Clark wrote:
>>>>>> There is no krealloc_array equivalent in devres. Users would have to
>>>>>> do their own multiplication overflow check so provide one.
>>>>>>
>>>>>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>>>>>> Signed-off-by: James Clark <james.clark@arm.com>
>>>>>> ---
>>>>>>    Documentation/driver-api/driver-model/devres.rst |  1 +
>>>>>>    include/linux/device.h                           | 11 +++++++++++
>>>>>>    2 files changed, 12 insertions(+)
>>
>> ...
>>
>>>> Maybe something could be done with some macro magic, but it would
>>>> probably end up being worse than just copying them and would affect the
>>>> real ones as well. So yeah I can't think of any easy gains either.
>>>
>>> Ok, that's good.  Given a lack of objections from others, I'll just take
>>> this through my driver core tree in a few days.
>>
>> Apologies for hijacking the thread. We have a series for CoreSight[1]
>> that depends on this series, which I see that, is queued in your
>> driver-core-next.
>>
>> I would like to queue [1] for the next version (as there are other
>> work that depend on this, e.g., [2]). Do you have any
>> recommendations/comments on the proposal ? Are you able to share a
>> stable branch which can be merged to coresight/next and queue the
>> series ontop ? (PS: I haven't queued anything for coresight/next yet).
> 
> You can pull from my driver-core-next branch just fine and assume it
> will be stable.  So just pull in that one commit and all should be good
> in the future.

Thanks Greg, I will give it a go

Suzuki

> 
> thanks,
> 
> greg k-h


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/4] devres: Provide krealloc_array
  2023-06-01  9:52             ` Suzuki K Poulose
@ 2023-06-05 13:39               ` Suzuki K Poulose
  2023-06-05 15:20                 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Suzuki K Poulose @ 2023-06-05 13:39 UTC (permalink / raw)
  To: Greg KH; +Cc: James Clark, linux-kernel, linux-arm-kernel, Coresight ML

Hi Greg

On 01/06/2023 10:52, Suzuki K Poulose wrote:
> On 01/06/2023 10:33, Greg KH wrote:
>> On Wed, May 31, 2023 at 11:44:55PM +0100, Suzuki K Poulose wrote:
>>> (Removed irrelevant recipients), +Cc: coresight ml

...

>>> Apologies for hijacking the thread. We have a series for CoreSight[1]
>>> that depends on this series, which I see that, is queued in your
>>> driver-core-next.
>>>
>>> I would like to queue [1] for the next version (as there are other
>>> work that depend on this, e.g., [2]). Do you have any
>>> recommendations/comments on the proposal ? Are you able to share a
>>> stable branch which can be merged to coresight/next and queue the
>>> series ontop ? (PS: I haven't queued anything for coresight/next yet).
>>
>> You can pull from my driver-core-next branch just fine and assume it
>> will be stable.  So just pull in that one commit and all should be good
>> in the future.
> 
> Thanks Greg, I will give it a go

Does this look fine with you ?

https://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux.git/log/?h=tmp/devm_krealloc_array

Suzuki

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/4] devres: Provide krealloc_array
  2023-06-05 13:39               ` Suzuki K Poulose
@ 2023-06-05 15:20                 ` Greg KH
  2023-06-05 15:59                   ` Suzuki K Poulose
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2023-06-05 15:20 UTC (permalink / raw)
  To: Suzuki K Poulose
  Cc: James Clark, linux-kernel, linux-arm-kernel, Coresight ML

On Mon, Jun 05, 2023 at 02:39:44PM +0100, Suzuki K Poulose wrote:
> Hi Greg
> 
> On 01/06/2023 10:52, Suzuki K Poulose wrote:
> > On 01/06/2023 10:33, Greg KH wrote:
> > > On Wed, May 31, 2023 at 11:44:55PM +0100, Suzuki K Poulose wrote:
> > > > (Removed irrelevant recipients), +Cc: coresight ml
> 
> ...
> 
> > > > Apologies for hijacking the thread. We have a series for CoreSight[1]
> > > > that depends on this series, which I see that, is queued in your
> > > > driver-core-next.
> > > > 
> > > > I would like to queue [1] for the next version (as there are other
> > > > work that depend on this, e.g., [2]). Do you have any
> > > > recommendations/comments on the proposal ? Are you able to share a
> > > > stable branch which can be merged to coresight/next and queue the
> > > > series ontop ? (PS: I haven't queued anything for coresight/next yet).
> > > 
> > > You can pull from my driver-core-next branch just fine and assume it
> > > will be stable.  So just pull in that one commit and all should be good
> > > in the future.
> > 
> > Thanks Greg, I will give it a go
> 
> Does this look fine with you ?
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux.git/log/?h=tmp/devm_krealloc_array

Looks good to me!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/4] devres: Provide krealloc_array
  2023-06-05 15:20                 ` Greg KH
@ 2023-06-05 15:59                   ` Suzuki K Poulose
  0 siblings, 0 replies; 8+ messages in thread
From: Suzuki K Poulose @ 2023-06-05 15:59 UTC (permalink / raw)
  To: Greg KH; +Cc: James Clark, linux-kernel, linux-arm-kernel, Coresight ML

On 05/06/2023 16:20, Greg KH wrote:
> On Mon, Jun 05, 2023 at 02:39:44PM +0100, Suzuki K Poulose wrote:

>> Does this look fine with you ?
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux.git/log/?h=tmp/devm_krealloc_array
> 
> Looks good to me!

Thank you so much for checking ! I will push this to coresight/next.

Suzuki

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-05 16:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230509094942.396150-1-james.clark@arm.com>
     [not found] ` <20230509094942.396150-2-james.clark@arm.com>
     [not found]   ` <2023051340-sinuous-darkroom-2497@gregkh>
     [not found]     ` <89ad5070-db72-7bf1-5d86-a89fea54e789@arm.com>
2023-05-15 11:55       ` [PATCH v4 1/4] devres: Provide krealloc_array Greg KH
2023-05-31 22:44         ` Suzuki K Poulose
2023-05-31 22:47           ` Suzuki K Poulose
2023-06-01  9:33           ` Greg KH
2023-06-01  9:52             ` Suzuki K Poulose
2023-06-05 13:39               ` Suzuki K Poulose
2023-06-05 15:20                 ` Greg KH
2023-06-05 15:59                   ` Suzuki K Poulose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).